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)
 Insert Query - Set based programming?

Author  Topic 

SQLNick
Starting Member

1 Post

Posted - 2009-01-23 : 15:15:25
Hi,

I've written a query inside a cursor which loops through each record inside a table and inserts a row into another table for each record in the first table.

Can anyone provide an example of how this can be achieved in a set based approach?

Thanks

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-01-23 : 15:29:53
INSERT INTO Table2
SELECT <yourColumns>
FROM
Table1

Jim
Go to Top of Page
   

- Advertisement -