BUG: INSERT EXECUTE Statement May Fail with Error 213ID: Q171875
|
If you use the INSERT EXECUTE statement and specify a column list to insert
into a table with a timestamp column, and the stored procedure called does
not return a value for the timestamp column in the result set, the INSERT
statement may fail with following error:
Msg 213, Level 16, State 1
Insert error: column name or number of supplied values does not match
table definition.
CREATE TABLE t1 (
test1 int NOT NULL ,
test2 timestamp NOT NULL ,
)
GO
CREATE TABLE t2 (
test1 int NOT NULL ,
test2 timestamp NOT NULL ,
)
GO
CREATE PROCEDURE sp_1 AS
select test1 from t1
GO
insert into t1 values (1,null)
insert into t1 values (2,null)
insert into t1 values (3,null)
GO
insert into t2 (test1) exec sp_1
GO
To work around this problem, modify the stored procedure to return a NULL
value for the timestamp column, as in the following example:
CREATE PROCEDURE sp_1 AS
select test1, null from t1
GO
Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Additional query words: Transact-SQL transql tsql
Keywords : kbusage SSrvTran_SQL kbbug6.50
Version : 6.5
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 19, 1999