Click here to Skip to main content
15,898,986 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I need to insert non-English (Kannada to be specific) data into sql-server database using my C# application....

How can i insert and retrieve unicode data from sql-server...???
Thank you,
Posted
Updated 6-Feb-13 19:42pm
v2

hi

You can not store unicode data in non unicode column. So you will have to store unicode data as nvarchar

SQL
DECLARE @Hindi varchar(64)
SET @Hindi = 'धन्यवाद'

DECLARE @nHindi nvarchar(84)
SET @nHindi = N'धन्यवाद'

SELECT @Hindi, @nHindi
In the above example when   'धन्यवाद' (Thank you in Hindi) stored as varchar it displays as ????? in the query editor.



or i think it may definetly helps you....
thanks

[From 2nd solution - same author]
hi

i think it may helps you....

Unicode Data Type in SQL[^]

thanks
 
Share this answer
 
v3
Comments
Sharath2790 7-Feb-13 2:18am    
Thank you, Really helped.... Please tell me method to retrieve it using (SELECT statement)....
Shubh Agrahari 7-Feb-13 2:52am    
as simple select statement like above mentioned for varchar SELECT @Hindi, and for nvarchar SELECT @nHindi....
Joezer BH 7-Feb-13 3:24am    
5+
SQL Server supports unicode characters with the nvarchar data type, so all you need to do is change your table column definitions to this data type.

Note: that if you do make sure you double the size you want since unicode is 2 bytes, for example if you need varchar(20) you should use nvarchar(40).
 
Share this answer
 
Comments
Joezer BH 7-Feb-13 3:24am    
5+
Mehdi Gholam 7-Feb-13 3:29am    
Thanks Edo!

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