BUG: Msg 257 When Inserting NULL values by RPCID: Q172335
|
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.
To work around this problem, replace NULL values with '' (null string).
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.
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
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