May 19, 2009 at 3:12 am
Hello,
I'm not sure about the use of putting 'N' before any query.
For eg -
Backup Database AdventureWorks to
Disk = N'C:\adv_test1.bak',
Disk = N'D:\adv_test1.bak',
with no format, noinit
Name = N'Adventure works-Full database backup',
skip, norewind, nounload, stats = 10
Please suggest.
Rgds,
Pankaj
May 19, 2009 at 3:29 am
By prefixing a constant string with "N", you are letting SQL to know that the string is a UNICODE string.
--Ramesh
May 19, 2009 at 3:38 am
Thanks for the reply Ramesh, However, i know it is for SQL to understand that it's gonna be a Unicode value....
that's my question actually that.... why do we need to pass a unicode value.... when do we actually need it..? what would happen if I'll not pass a unicode value ..... bottom line is .... what is the advantage of it?
Rgds,
Pankaj
May 19, 2009 at 3:45 am
Hi
I would say it depends.
In maintenance scripts I think it is a "best practice", SSE does the conversion and the overhead should be okay.
In procedures and functions you should use an explicit Unicode string if your values are Unicode. If you don't specify the N'' SSE has to convert your constant text with every call of the compiled module.
Greets
Flo
May 19, 2009 at 4:34 am
pankaj.baluni (5/19/2009)
.... why do we need to pass a unicode value
When the calling procedure expects a UNICODE value
pankaj.baluni (5/19/2009)
when do we actually need it..?
To support international language support
pankaj.baluni (5/19/2009)
.... what would happen if I'll not pass a unicode value
SQL Server will try to convert the non-unicode value to a unicode value and thereby adding additional overhead on SQL Engine.
pankaj.baluni (5/19/2009)
..... bottom line is .... what is the advantage of it?
Support for international languages
--Ramesh
May 19, 2009 at 6:45 am
Thank you very much Ramesh,
That answers all my questions.... 😛
Rgds,
Pankaj
May 19, 2009 at 6:56 am
You are welcome..
--Ramesh
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply