FIX: sp_addtype Ignores NULL For the nulltype Parameter

Last reviewed: May 1, 1997
Article ID: Q135859

The information in this article applies to:
  • Microsoft SQL Server, version 6.0
BUG# NT: 11247 (6.00)

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 : kbbug6.00 kbfix6.00.sp3 kbprg SSrvProg
Version : 6.0
Platform : WINDOWS
Resolution Type : kbcode


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 1, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.