Wednesday, March 21, 2012

N Preceding Strings when Scripting Objects

When an Object is scripted in From Enterprise Manager it Precedes
Strings with an "N" however these scripts seem to still work if the N
is removed so I would assume that the "N" has something to do with
collation or the Encoding or something. I've tryed to find something
about it on the net but found nothing, can anyone tell me what it does?
Thanks in Advance.
Example :
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[Options]') and OBJECTPROPERTY(id, N'IsUserTable') =
1) drop table [dbo].[Options]
GON'my string'
The above is a unicode string
'my string'
The above isn't unicode.
Unicode basically stores 2 bytes per character to allow for asian character
sets.
Tony.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
<cameron.waldron@.gmail.com> wrote in message
news:1145530123.392023.62250@.z34g2000cwc.googlegroups.com...
> When an Object is scripted in From Enterprise Manager it Precedes
> Strings with an "N" however these scripts seem to still work if the N
> is removed so I would assume that the "N" has something to do with
> collation or the Encoding or something. I've tryed to find something
> about it on the net but found nothing, can anyone tell me what it does?
> Thanks in Advance.
> Example :
> if exists (select * from dbo.sysobjects where id =
> object_id(N'[dbo].[Options]') and OBJECTPROPERTY(id, N'IsUserTable') =
> 1) drop table [dbo].[Options]
> GO
>

No comments:

Post a Comment