Srilaxmi
Srilaxmi

Reputation: 109

How to map the collation in sqlserver to C# CultureInfo object? what should be the parameter for CultureInfo class?

Am trying create a CultureInfo object in my C# application based on the collation details retrieved from SqlServer. When I query the database, collation details I receive is Latin1_General_CI_AI. How to use this info to create the cultureInfo object? Is there any other way to create cultureInfo object which matched the collation of SqlServer database?

Please provide your response.

Upvotes: 3

Views: 1535

Answers (2)

Srilaxmi
Srilaxmi

Reputation: 109

This is query to get the LCID of the column in the table - "SELECT COLLATIONPROPERTY('COLLATIONPROPERTY', 'LCID') as 'LCID'" where as COLLAtIONPROPERTY is the collation name of the particular column.

Upvotes: 0

TomTom
TomTom

Reputation: 62093

You do not. THere is no general mapping - especially as the SQL Server collations do combine code pages (not represented in C# CultureInfo) as well as implementation details (CL_AI actually are flags that indicate special behavior). There is no direct mapping also as a culture info contains additional information under the granularity of a collation which does not bother with elements like how numbers are to be formatted.

Upvotes: 2

Related Questions