November 14, 2006 at 9:46 am
Hi - in the following
if not exists (select * from dbo.sysusers where name = N'A01' and uid < 16382)
EXEC sp_grantdbaccess N'A01', N'A01'
GO
what is the N in N'A01' doing ?
November 14, 2006 at 9:48 am
It converts to unicode.
November 14, 2006 at 9:49 am
N'A01' tells SQL Server to treat the contents of the string, in this case A01, as Unicode. If you look at the sysusers.name column, it is of data type SysName. SysName is a unicode datatype equal to nvarchar(128).
November 14, 2006 at 9:59 am
John - thanks for that.
(Where are you supposed to find that out for yourself?!)
November 14, 2006 at 10:03 am
Books online / Unicode / Constants.
By you pretty much need to know what you are searching for in this case .
November 15, 2006 at 1:55 am
The key to remember is that Unicode takes two bytes per character so all your Unicode fields take twice as much space (and you can only get half as many in a record). Only use it if you need to handle Unicode characters.
November 15, 2006 at 6:46 am
Good point... but I think the poster was reffering to some generated code (most likely EM)!
November 15, 2006 at 6:53 am
You're right - but I thought the warning wouldn't go amiss. It looked as if he wasn't aware of this feature so doesn't hurt to pre-empt any future issues. 🙂
November 15, 2006 at 7:11 am
Totally with you on this one .
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply