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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how 2 append data from a stored procedure to table
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

learning_grsql
Posting Yak Master

230 Posts

Posted - 09/27/2012 :  09:21:15  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2241 Posts

Posted - 09/27/2012 :  09:28:50  Show Profile  Reply with Quote
INSERT INTO realdate (col1, col2, col3)
EXEC sprealdata


--
Chandu
Go to Top of Page

webfred
Flowing Fount of Yak Knowledge

Germany
8781 Posts

Posted - 09/27/2012 :  09:29:53  Show Profile  Visit webfred's Homepage  Reply with Quote
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.

Edited by - webfred on 09/27/2012 09:30:35
Go to Top of Page

learning_grsql
Posting Yak Master

230 Posts

Posted - 09/27/2012 :  10:40:06  Show Profile  Reply with Quote
Thanks bandi & webfred
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000