views:

57

answers:

3

Today I came across an SQL statement that contains an element I've never seen. Maybe someone can elaborate? This SQL is from a stored procedure in Sybase ASE 15

SELECT O.id, OWNER = U.name, O.name, O.type FROM xxx.dbo.sysobjects O LEFT JOIN xxx.dbo.sysusers U ON O.uid = U.uid WHERE (O.type = N'U' OR O.type = N'S' OR O.type = N'V') ORDER BY O.name

Running

SELECT O.id, OWNER = U.name, O.name, O.type FROM xxx.dbo.sysobjects O LEFT JOIN xxx.dbo.sysusers U ON O.uid = U.uid WHERE (O.type = 'U' OR O.type = 'S' OR O.type = 'V') ORDER BY O.name

gives the same result as the SQL above.

What does the N infront of the parameter do?

+1  A: 

The N ensures the value stated is treated as unicode

AdaTheDev
Thanks for the prompt answer!
Sascha Kaestle
A: 

It's a "nationalized" (Unicode) string.

ngroot
A: 

The N stands for National - the N converts the VARCHAR to a NVARCHAR, which is used to store unicode data, which is used to store multilingual data in your database tables.

Greg