sysname is a special datatype and by default it does not allow NULL, you need to explicitly add NULL in table definition to allow null. sysname is defined as
nvarchar(128) not null
Below code will give error
declare @t1 table ( c1 int, c2 sysname) insert into @t1 select 1, NULL
Published under: SQL Server Tips · · · ·
Perfectly logical, but had never taken the time out to try it. Thank-you very much, Chintak!