BUG: Msg 257 When Inserting NULL values by RPC

Last reviewed: August 4, 1997
Article ID: Q172335
The information in this article applies to:
  • Microsoft SQL Server, version 6.5
BUG #: 17124 (SQL 6.5)

SYMPTOMS

If you use an INSERT statement with a remote stored procedure call to insert NULL values, you may receive the following error:

   Msg 257
   Implicit conversion from datatype 'int' to 'varchar' is not allowed. Use
   the CONVERT function to run this query.

The same script running on a local server works correctly.

This problem has been tested on SQL Server build 6.50.258.

WORKAROUND

To work around this problem, replace NULL values with '' (null string).

STATUS

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

MORE INFORMATION

The following script demonstrates the problem:

   On server A
   -----------

   create table rpctestA
   (
   col1 char(2) not null,
   col2 char(2) null
   )

   create proc insert_rpctestA
   @sNo char(2)
   as
   begin
      insert rpctestA
      exec markweb01.pubs.dbo.select_rpctestB @sNo
   end

   On server B
   -----------

   create table rpctestB
   (
   col1 char(2) not null,
   col2 char(2) null
   )

   insert rpctestB values ('AA', 'BB')

   create proc select_rpctestB
   @sNo char(2)
   as
   begin
       select col1, null
       from rpctestB
       where col1 = @sNo
   end

   On server A
   -----------

   exec insert_rpctestA

At this point, you will receive the following error:

   Msg 257, Level 16, State 1
   Implicit conversion from datatype 'int' to 'varchar' is not allowed.
   Use the CONVERT function to run this query.


Additional query words: rpc
Keywords : kbbug6.50 SSrvGen kbusage
Version : 6.5
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbworkaround


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