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
 how 2 append data from a stored procedure to table

Author  Topic 

learning_grsql
Posting Yak Master

230 Posts

Posted - 2012-09-27 : 09:21:15
I have a stored procedure named "sprealdata" which has data of 3 columns and around 50,000 rows

Now I would like to append these data into a table.

I already created a table named "realdata" with three columns. Now I want to append the data from stored procedure to the table using query. Of course I can copy and paste but I don't prefer this.

If it is from another table, I would write like this :


insert into realdata
select * from anothertablename


bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-09-27 : 09:28:50
INSERT INTO realdate (col1, col2, col3)
EXEC sprealdata


--
Chandu
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-09-27 : 09:29:53
I don't know the columns but this way:

insert realdata(Col1, Col2, Col3, ...)
exec sprealdata


Too old to Rock'n'Roll too young to die.
Go to Top of Page

learning_grsql
Posting Yak Master

230 Posts

Posted - 2012-09-27 : 10:40:06
Thanks bandi & webfred
Go to Top of Page
   

- Advertisement -