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
 sproc - select from one table, insert into another

Author  Topic 

crugerenator
Posting Yak Master

126 Posts

Posted - 2011-03-07 : 12:50:48
I was hoping to write a stored proc that would accept two parameters and select from one table base off of those parameters and then instert the results from that query into another table based off of the returned results. I was hoping to do this without temp tables.

example in pseudo code.

call sproc, pass in projID and zoneID.

sproc queries TABLE1 where projID and zoneID match passed in params. returns all values.

insert returned values into another table.





webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-03-07 : 13:09:37
insert dest_table(col1,col2,...)
select col1,col2,...
from source_table where column = @param


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -