BUG: INSERT EXECUTE Statement May Fail with Error 213Last reviewed: July 30, 1997Article ID: Q171875 |
The information in this article applies to:
SYMPTOMSIf 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.The following scenario demonstrates this problem:
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 GOThe INSERT fails with the error message described above.
WORKAROUNDTo 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 STATUSMicrosoft 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |