BUG: Example of Sp_addtype Is Unclear in the Documentation

Last reviewed: April 15, 1997
Article ID: Q157980
The information in this article applies to:
  • Microsoft SQL Server, version 6.0
BUG #: 16126 (Windows: 6.50.201)

SYMPTOMS

Example B in the "Transact-SQL Reference" section on sp_addtype does not always add a user-defined datatype that defaults to allowing nulls.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0 documentation. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

In the section on the nulltype parameter for sp_addtype, the "Transact-SQL Reference" correctly states that if a null value is specified for this parameter, the default nullability setting of the data type will be based on the current ansinull setting for the connection. You can determine what the current setting is by using the system function getansinull(); you can control the setting with the SET and sp_dboption commands.

The following command in example B is supposed to always enable the default nullability of a user-defined datatype:

   sp_addtype birthday, datetime, NULL

However, specifying NULL for the nulltype parameter passes a null value into sp_addtype, not the string "NULL." The command above will therefore set birthday's nullability default to the current ansinull setting. If ansinull is off, then birthday will default to not null. If you want a datatype to default to allowing nulls regardless of the current setting of ansinull, you should instead use the following command:

   sp_addtype birthday, datetime, 'NULL'


Additional query words: wrong incorrect erroneously erroneous
Keywords : kbbug6.00 kbusage SSrvDoc_Err SSrvStProc SSrvTran_SQL
Version : 6.0
Platform : WINDOWS
Issue type : kbdocerr


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: April 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.