Reputation: 1458
I'm looking to find if it's possible to store characters from multiple languages with widely varying character set (e.g. Latin and Japanese alphabet) into a VARCHAR
column in SQL Server 2008/12 DB. I read about the concept of collations in sql server. I cannot change the data type to NVARCHAR
. Is there a code page that mimics the Unicode character set ? Is it correct to say that data in a column of the type VARCHAR
would be encoded as per the code page specified in the collation ? In addition, how does the system maps characters from one code page to other ?
Upvotes: 1
Views: 554
Reputation: 10098
You will have to use nvarchar
datatype to store characters that occupy more than one byte (yes, I know that you've said that you can't change it, just talking about the options).
If one byte is enough, I'd recommend using different column with appropriate collation for each language. Collations affect not only comparation and sorting, but also a way the information is stored and possibly transformed (which is not a good thing when it happens).
If you don't need localized sorting capabilities, use binary
collation.
There is also a sample on MSDN on using UTF-8 UDT:
http://msdn.microsoft.com/en-us/library/ff877964%28v=sql.110%29.aspx
Upvotes: 1