Microsoft KB Archive/135859

{|
 * width="100%"|

FIX: sp_addtype Ignores NULL For the nulltype Parameter

 * }

Q135859

-

The information in this article applies to:


 * Microsoft SQL Server version 6.0

-

SYMPTOMS
If the nulltype parameter passsed to sp_addtype is NULL, the user-defined datatype should be nullable by default. This is not the case as can be verified from the allownulls column of systypes. A user-defined datatype has an allownulls value of zero in systypes even though it is defined with NULL parameter to sp_addtype.

WORKAROUND
Enclose the keyword NULL within single quotes. For example:

  exec sp_addtype lname,'char(20)', 'null'

STATUS
Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server version 6.0. For more information, contact your primary support provider.

MORE INFORMATION
To replicate this problem:

  use pubs go  exec sp_addtype lname,'char(20)', null go  create table testaddtype (x lname) go  print ' ' print 'SHOULD ALLOW NULL TO BE INSERTED BUT DOES NOT' print ' ' insert into testaddtype values (NULL) go  print ' ' print 'ALLOWNULLS SHOULD ACTUALLY BE 1 IN THE FOLLOWING RESULT:' print ' ' select name, allownulls from systypes where name = 'lname' go Additional query words: sql6

Keywords : kbprogramming

Issue type : kbbug

Technology : kbSQLServSearch kbAudDeveloper kbSQLServ600