BUG: Msg 257 When Inserting NULL values by RPCLast reviewed: August 4, 1997Article ID: Q172335 |
The information in this article applies to:
SYMPTOMSIf 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.
WORKAROUNDTo work around this problem, replace NULL values with '' (null string).
STATUSMicrosoft 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 INFORMATIONThe 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_rpctestAAt 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |