How to get the collation name from a collation ID?

Hi,

I am using SQL Server 2008. In ServerProperty function,
there are two properties called “Collation” and “CollationID”.
In some cases, I will only know the CollationID. Is it possible get the
collation name from the CollationID? Is there a function called
CollationNameFromID?

Thanks

select *
, COLLATIONPROPERTY(name,'CollationID') CollationID
, COLLATIONPROPERTYFROMID(CAST(COLLATIONPROPERTY(name,'CollationID') as int), 'Name') CollationNameFromID
from fn_helpcollations()
1 Like

Hi,

Thanks. Is COLLATIONPROPERTYFROMID a funciton in SQL Server? It seems the function is not available in SQL Server 2008 or higher versions?

COLLATIONPROPERTY

https://msdn.microsoft.com/en-us/library/ms190305.aspx

It is available from 2005 onwards

Well, I pulled it from SQL 2012, and I blogged about it prior to 2012's release:

http://weblogs.sqlteam.com/robv/archive/2010/10/01/handy-sql-server-function-series-part-1.aspx

It's not a documented function perhaps, but it's available via Intellisense in 2012.

Thank you very much. It works!