user279521
user279521

Reputation: 4807

SQL Server syntax question

USE AdventureWorks;
GO
IF OBJECT_ID (N'dbo.AWBuildVersion', N'U') IS NOT NULL
DROP TABLE dbo.AWBuildVersion;
GO

Whats the N symbolize in N'dbo.AWBuildVersion' & N'U' ?

Upvotes: 1

Views: 154

Answers (3)

Randy Minder
Randy Minder

Reputation: 48412

It's for Unicode. It's like an nvarchar or nchar SQL data type.

For more information, see this: You must precede all Unicode strings with a prefix N when you deal with Unicode string constants in SQL Server

Upvotes: 2

DOK
DOK

Reputation: 32841

When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N.

The "N" prefix stands for National Language in the SQL-92 standard, and must be uppercase.

If you do not prefix a Unicode string constant with N, SQL Server will convert it to the non-Unicode code page of the current db before it uses the string.

Sometimes people use N' out of habit, not when it is really necessary.

Upvotes: 1

Peter Loron
Peter Loron

Reputation: 1156

This StackOverflow article has info on the subject. Basically the 'N' prefix denotes a Unicode string.

Upvotes: 1

Related Questions