Character Map for Varchar & Nvarchar
This post I want to discuss about Character Map supported for SQL Server varchar & nvarchar data types. Everyone knows varchar is variable length, non-Unicode string data. And if we take nvarchar it's variable-length, UNICODE UCS-2 character set. And also ANSI_PADDING is always ON for nvarchar.
Following example will help you find both supported Character
Now let me explain which Character not supported varchar.
;WITH tblNumbers AS(SELECT 1 AS NumberUNION ALLSELECT Number+1FROM tblNumbersWHERE Number+1<257)SELECT Number AS ASCII_Value,CAST(CHAR(Number) AS varchar(10)) COLLATE SQL_Latin1_General_CP1_CI_AS AS ASCII_Char_General,CAST(CHAR(Number) AS varchar(10)) COLLATE Finnish_Swedish_CI_AS AS ASCII_Char_Swedish,CAST(CHAR(Number) AS varchar(10)) COLLATE DANISH_NORWEGIAN_CI_AS AS ASCII_Char_DANISH,CAST(CHAR(Number) AS nvarchar(10)) COLLATE SQL_Latin1_General_CP1_CI_AS AS ASCII_Char_General_nvarchar,CAST(CHAR(Number) AS nvarchar(10)) COLLATE Finnish_Swedish_CI_AS AS ASCII_Char_Swedish_nvarchar,CAST(CHAR(Number) AS nvarchar(10)) COLLATE DANISH_NORWEGIAN_CI_AS AS ASCII_Char_DANISH_nvarcharFROM tblNumbersOPTION (MAXRECURSION 257)
SELECT CAST(N'ɽ' as varchar(2)) [varchar],CAST(N'ɽ' AS nvarchar(2)) [nvarchar];
SELECT CAST(N'Ȏ ȣ ǧ ǒ ƾ ƛ A ® ¶ Ĥ Ʒ' as varchar(50)) [varchar],CAST(N'Ȏ ȣ ǧ ǒ ƾ ƛ A ® ¶ Ĥ Ʒ' AS nvarchar(50)) [nvarchar];
Hope now you have clear idea what is different between varchar and nvarchar.
Cheers...
and Most welcome your comments and ideas...
ReplyDeleteThank you so much for all the wonderful information about Technology! I love your work.
Core Spring Training
Springsource Training
Spring and Hibernate Training
Hibernate Training in Chennai
Hibernate Training
Hibernate Training in Velachery
spring hibernate training institutes in chennai
Hibernate Training in Chennai
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. whatcountyamiin.net
ReplyDeleteHardly any purchasers know it, yet the errand of purchasing a guide for the divider is stacked with conceivable outcomes of committing an error that the buyer later will lament. Fókuszpályázat
ReplyDeleteYou make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. where to get nonsurgical cci treatment
ReplyDeleteAffection to peruse it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks. visit here
ReplyDelete