What does N indicate in the following script
SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].xxxx' )
Plz can anyone explain
EXEC dbo.sp_executesql @.statement = N'Create View xxxxx'
The 'N' in the likes of N'[dbo].xxxx' and N'Create View xxxxx' indicates an NVARCHAR datatype. This is the datatype that is used for representing UNICODE strings. The NVARCHAR datatype uses two bytes to represent each character whereas the VARCHAR datatype uses one byte to represent each character.
Also, if you are asking for an explanation of the statement:
Code Snippet
EXEC dbo.sp_executesql @.statement = N'Create View xxxxx'
The "sp_executesql" stored procedure is a stored procedure that is used for executing dynamically created SQL statements. In this case the dynamic SQL statement is the "CREATE VIEW ... " piece. And in this case this statement is used to create a view.
|||Thank you...i have also seen from the MSDN help that N denotes unicode strings which uses 2 bytes to represent each character|||That is correct. Nvarchar/Nchar will store UNICODE values.
No comments:
Post a Comment