March 20, 2006 at 5:05 pm
Hi,
I have a stored procedure that returns a resultset. I want to insert this resultset into another table. I tried this,
INSERT INTO table1 EXEC proc_storedproc1
It returns an error saying the columns does not match. I think it is trying to insert the value 'EXEC proc_storedproc1' into table1. Can we do inserts like this? If yes, can you tell me what is the correct syntax.
Thanks.
March 20, 2006 at 5:09 pm
Compare resultset of EXEC proc_storedproc1 to column definitions for table1.
They must be different.
_____________
Code for TallyGenerator
March 20, 2006 at 10:41 pm
I checked it. Its the same.
March 21, 2006 at 8:13 am
Maybe best to check again.
Your syntax is fine, but the result returned does not match the table you're trying to insert into.
They aren't the same.
If you still can't find the difference, can you post the table definition, and a sample row of what the proc returns?
/Kenneth
March 21, 2006 at 10:14 am
I checked it. Its not the same. Sorry.
The table I am working on inside the sproc and the table I am trying to insert into have the same definition. But I missed a column in the sproc select statement.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply