BUG: Msg 257 When Inserting NULL values by RPC

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 : kbusage SSrvGen kbbug6.50
Version : 6.5
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: April 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.