Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello experts, Which data type we should take if we want to store UNICODE text in a field of a database table, say name of a person in devnagri.

In MS-Access, i have taken the field type 'Text' and it works, but the same does not work in SQL Server 2005.

My OS is Windows 7 ultimate. 64 bit

thanks in advance.

-prateek.
Posted

You need to use collation
http://msdn.microsoft.com/en-us/library/ms143508(v=sql.90).aspx[^]
SQL
ALTER COLUMN Column1 NVARCHAR(100)
COLLATE Indic_General_90_CI_AS
 
Share this answer
 
Take the Field Data Type as nvarchar(len)


where len is the field length

prefix the value of the field with 'N' while inserting, like

VB
strQuery = "INSERT INTO TableName( Col1, Col2, Col3) VALUES (" +
                   "\'" + Val1 + "\'," +
                   "\'" + Val2 + "\'," +
                   "N\'"+ val3 + "\')";


notice the N before the value of col3. as seen above,
in the above code segment, Col3 has Unicode Text.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900