What does N and U mean and what is its meaning when searching for an object

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

I do not understand what N and U for SQL Server?

thank

+4
source share
2 answers

'U'The symbol denotes itself. The prefix Nmakes it a single-character UNICODE string. The OBJECT_ID procedure expects you to pass one of the predefined single-character values ​​for the second parameter, which should be a UNICODE string.

This syntax is used to create literals with characters in other encodings, for example

CREATE TABLE hello_world (str NVARCHAR(20))
INSERT INTO hello_world (str) VALUES (N', !')
+4
source
  • Umeans Table (user-defined).For more information check here . The syntax is equal to OBJECT_ID

    OBJECT_ID ( '[ database_name . [ schema_name ] . | schema_name . ] 
    object_name' [ ,'object_type' ] )
    

    here Object_type = 'U'which denotesTable (user-defined)

  • N String nvarchar data type. , (N      ).      NCHAR, NVARCHAR NTEXT,      CHAR, VARCHAR TEXT.
+3

All Articles