SQL SERVER – Find collation of table column using tsql

 
There are many ways to find collation of table column and database in sql server, simplest way is using ssms (sql server management studio).
 
First connect to sql server instance using ssms 
-> Select your database 
-> Right click on it 
-> Properties
 
 
Here you will see collation of database under maintenance option.
 
Below tsql script will also give same result.
 
SELECT DATABASEPROPERTYEX(‘DBA’, ‘Collation’)
 
 
To find collation of sql server database table column using ssms
 
-> Click on new query
 
USE DBA
 
sp_help ‘tablename’
 
It will display table information with column name, collation, datatype, size and so on 
 
You can also use below query to find Collation for particular table column. 
 
USE DBA
GO
 
SELECT name, collation_name
FROM sys.columns col
WHERE col.OBJECT_ID IN (SELECT OBJECT_ID FROM sys.objects t WHERE t.type = ‘U’ AND t.name = ‘DBInformations’)
AND col.name = ‘Status’
 
 
Here t.name = ‘tablename’ and col.name= ‘Column_name’

Leave a Reply

  

  

  


2 + = 8