Yes, nvarchar comes with unicode support & thus we use it when we want support for different languages.
But have you ever wondered, why it is called as nvarchar ? If yes then here is the answer..
As per ANSCI standards, nvarchar stands for "National character varying". so while declaring any column/variable in SQL of type nvarchar you can also specify it as follows.
create table tEmployeeMaster(
EmployeeName national character varying(64)
)
One more important thing to note about this database is, whenever you try to insert some string value into nvarchar column/variable, SQL server needs first cast it from varchar to nvarchar and then stores it.
Insert Into tEmployeeMaster values('Mirza Ateeq Baig')
Now here there is some casting overhead for SQL server to cast string to nvarchar.
There is one way to avoid this casting overhead. Above insert statement can also be written as follows.
Insert Into tEmployeeMaster values(N'Mirza Ateeq Baig')
The prefix N before string indicates that the string should be treated as nvarchar. So now SQL server knows that this is nvarchar, thus no casting is required in this case.
Hope that this is useful for some of you. cheers,
Chacha ek dum cha gaye..bahut badiya likkhe ho..maza aa gaya..feeling something learned.
ReplyDeleteChicha where r u these days, not writing or updating anything - Ashraf Qatar
ReplyDelete