Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 what is EXECUTE (N'SELECT .........

Author  Topic 

jim_cool
Starting Member

43 Posts

Posted - 2006-02-24 : 00:19:30
i came across one query that starts with

EXECUTE (N'SELECT .........

plz , can anyone tell me what is this N'SELECT ?
what it does?
plz help me.

Kristen
Test

22859 Posts

Posted - 2006-02-24 : 00:22:23
N'xxx' means that the text string "xxx" is in Unicode (2 bytes per character, allowing for foreign language characters etc.), rather than plain ASCII.

Kristen
Go to Top of Page

jim_cool
Starting Member

43 Posts

Posted - 2006-02-24 : 00:34:46
thanks for ur reply.
but as a beginner i found it difficult to understand.
can u plz give me some link that ezplins this in much esiear way?
or can u plz exlain me this in detail?
i will ve thankfull to u.
hoping to get response from u.
bye.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-02-24 : 01:07:34
In one byte you can store 256 different values.

ASCII defines the characters from 32 to 127 (space, punctuation, digits, upper case, lowercase).

From 0-31 are control characters - like Tab and LineFeed. And stuff that was used in the days of punch cards!

From 128-255 are sort-of-general. Tends to include foreign accents, and the UK Pound sign and Japanese Yen sign is in there. BUT not all character sets use the same display ... so in one font you might get the value you expect, in another font you will get something completely different.

And in a Symbol font you may not even get the letters <g>

And if you want Chinese characters, or Cyrillic alphabets then you are fresh out of luck ....

So they came up with the idea of using TWO bytes for each character. The coding for that, called UNICODE, is constant for all character sets. So an "A" is an "A" is an "A" ...

However, 2 byte UNICODE takes up .... errrmmm .... twice as much space as ASCII ... so its a waste unless you really need it.

There are 3 string handling datatypes in SQL Server - char, varchar and text. Each of these has a UNICODE variant called Nchar, Nvarchar and Ntext.

Note that the limit for VARCHAR is 8,000 characters, and the limit for Nvarchar is 4,000 - another limitation to be aware of!

Most system functions/proc take Nvarchar parameters, including EXEC, and that's probably why the code sample you are using expresses the string constant as N'xxx'

Nope that a) helps and b) that I've got it right!

Kristen
Go to Top of Page
   

- Advertisement -