April 30, 2010 at 3:54 am
I am using Hindi fonts in windows application.
I have setted down the font of text box as hindi font. I am saving the text in sql server database
What is the best datatype of saving such text. ntext,varchar or nvharchar
May 2, 2010 at 6:28 am
gaurav-404321 (4/30/2010)
I am using Hindi fonts in windows application.I have setted down the font of text box as hindi font. I am saving the text in sql server database
What is the best datatype of saving such text. ntext,varchar or nvharchar
Definitely not TEXT or NTEXT - these are deprecated and will be removed from SQL Server in a future release.
VARCHAR cannot be used because the characters you need only exist in Unicode.
So, your choice is NCHAR or NVARCHAR.
Example: (notice the N before the string literals to specify Unicode)
DECLARE @String1 NVARCHAR(200);
DECLARE @String2 NCHAR(191);
SET @String1 = N'???????? 1 — ??? ???????? ?? ???? ?? ???????? ?? ????? ??? ??????? ??????????? ??????? ??? ?????? ?????? ?? ?????????? ?? ??? ??????? ?? ?? ?????? ?????? ??????? ?? ??? ?? ?????? ???? ???????';
PRINT @String1;
SET @String2 = N'???????? 1 — ??? ???????? ?? ???? ?? ???????? ?? ????? ??? ??????? ??????????? ??????? ??? ?????? ?????? ?? ?????????? ?? ??? ??????? ?? ?? ?????? ?????? ??????? ?? ??? ?? ?????? ???? ???????';
PRINT @String2;
-- Collations that may be of interest
SELECT name
FROM fn_helpcollations()
WHERE name LIKE N'Indic_General_%'
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply