Thursday, October 4, 2012

SQL SERVER – Find Collation of Database and Table Column Using T-SQL

 

Today we will go over very quick tip about finding out collation of database and table column. Collations specify the rules for how strings of character data are sorted and compared, based on the norms of particular languages and locales
Today’s script are self explanatory so I will not explain it much.
/* Find Collation of SQL Server Database */SELECT DATABASEPROPERTYEX('AdventureWorks', 'Collation')GO/* Find Collation of SQL Server Database Table Column */USE AdventureWorks
GO
SELECT name, collation_nameFROM sys.columnsWHERE OBJECT_ID IN (SELECT OBJECT_IDFROM sys.objectsWHERE type = 'U'AND name = 'Address')
AND
name = 'City'
Reference : Pinal Dave (http://blog.SQLAuthority.com)

No comments:

Post a Comment