Wednesday, July 29, 2015

SYSNAME Data type in SQL Server

/* The sysname data type is used for table columns, variables, and stored procedure parameters that store object names. 
   The exact definition of sysname is related to the rules for identifiers. Therefore, it can vary between instances of SQL Server.
   sysname is functionally the same as nvarchar(128) except that, by default, sysname is NOT NULL. In earlier versions of SQL Server,
   sysname is defined as varchar(30).


declare @procname sysname;

set @procname = N'sys.sp_columns'

exec @procname @table_name = N'objects', @table_owner = N'sys'

No comments:

Post a Comment