PRB: Host_name() Function Returns NULL Value

Last reviewed: April 28, 1997
Article ID: Q101847

The information in this article applies to:
  • Microsoft SQL Server version 4.2 for OS/2

SYMPTOMS

After upgrading from version 1.x to 4.2, an application or stored procedure that uses the system function host_name() to insert a value into a row generates the following error message (error 515):

   Attempt to insert the value NULL into column '%.*s', table '%.*s';
   column does not allow nulls. Update fails.

CAUSE

The system function host_name() has changed behavior between version 1.x and 4.2. The host_name() function is supposed to return the value that was set by the front-end application by calling DBSETLHOST. If this was not set by the application, the return value depends on the version of the SQL Server; version 1.x returns a string of 30 spaces, and version 4.2 returns a NULL value.

RESOLUTION

There are several ways to address this situation. The application could be changed to call DBSETLHOST to provide a value. Secondly, the column that is used to store the host_name could be changed to allow NULLs, or, in the case of a stored procedure, the ISNULL function could be used to provide a value when host_name returns NULL.


Additional query words: DB-Lib DB-Library dblib 4.2 4.2a
Keywords : kbother SSrvServer
Version : 4.2
Platform : OS/2
Issue type : kberrmsg


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