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
 General SQL Server Forums
 New to SQL Server Programming
 copying data into another table using a stored pro

Author  Topic 

pazzy11
Posting Yak Master

145 Posts

Posted - 2007-04-19 : 10:20:50
Can i do something like this

INSERT INTO CITIBANK.dbo.Contract (*)
FROM exec sp..

where sp is the stored procedure ?

Or do i need to specify all the colums where the * is ?
and if so is it the columns from the SP or the colums
from the destination table ?


X002548
Not Just a Number

15586 Posts

Posted - 2007-04-19 : 11:06:08
Weill it's just a good idea to have a column list...plus I didn't think you could use * in an INSERT Statement



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-19 : 11:09:38
[code]
INSERT INTO CITIBANK.dbo.Contract (col1, col2 .. . )
FROM exec sp..
[/code]



KH

Go to Top of Page

pazzy11
Posting Yak Master

145 Posts

Posted - 2007-04-19 : 11:11:03
Thanks guys !!!

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-04-19 : 11:18:56
Understand though that the table needs the exact number of columns and datatypes as the result set from the sproc...and if you have more than 1 result set, it won't work



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -