0

SQL Server 2008 - Table contains nvarchar(max) datatype and store hindi & english data without N' prefix. like - "मांगलिक welcome" but in table store as "׿¢»çÜ·¤ welcome".

Please guide how to display the data from SQL server in .net.

2 Answers2

0

The N prefix only denotes the string is NVARCHAR as opposed to VARCHAR

See this for more info

C# is Unicode by default so your data will be ok.

In fact re-reading your question I'm not sure what you are asking.

Are you saying you store the data in the database WITHOUT the N prefix ? Is this done via .net ?

Can you please make your question clearer ?

** EDIT

I'm not sure you can. The data outside of the non Unicode code page will be lost.

Check this page here for further details

Community
  • 1
  • 1
SteveB
  • 1,474
  • 1
  • 13
  • 21
0

First try to create a table as shown:

Create table TestLang (strText nvarchar(max))

Next try to insert values

insert into TestLang values ( N'मांगलिक')
insert into TestLang values ( N'Welcome')

Now try to search the name as shown:

SELECT * FROM TestLang WHERE strText LIKE N'मां%'

UPDATE:

If you want to display the data try this way:

string input = "0928;0940;0932;092E;";
Regex rx = new Regex(@"([0-9A-Fa-f]{4});");
string output = rx.Replace(input, match => ((char)Int32.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString());
Output: "नीलम"

Took from here

coder
  • 13,002
  • 31
  • 112
  • 214
  • In this way it working.. but table have already have data (׿¢»çÜ·¤ welcome) without using N' prefix. Guide how to display the data. – user2717440 Sep 26 '13 at 09:44