Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Inserting to data from SP

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-11-26 : 08:11:14
Dear All,
I am using stored proc to get the result set..intend i need to insert into another table straight way..how can we do this ??


exec camparetable 'vw-Ob','TabletoCompare',1

i need to insert the outout of the above query to one more table how can we do this ?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-26 : 08:27:58
insert into table(columns)
exec camparetable 'vw-Ob','TabletoCompare',1

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-11-26 : 09:41:52
I am getting the following error..though even i have given number column equal
msg:213 level:16 state :7 Line 1
Insert error:column name or number of supplied values does not match table definition
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-11-26 : 11:55:40
the names of the columns have to match as well. And the data types (I think)


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -