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.
| Author |
Topic |
|
igorblackbelt
Constraint Violating Yak Guru
407 Posts |
Posted - 2007-07-21 : 21:42:28
|
| Guys, I have to create an sp that will insert records from one table into many tables in one single database, does anyone has done that? Any links that might help me accomplish this?Thanks! |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-07-21 : 23:25:52
|
If you have the list of table names you can create a dynamic SQL and execute it.Set @Sql = 'INSERT INTO dbo.' + @TableName + '( columnlist) SELECT <column list> FROM dbo.YourTable WHERE ...'EXEC(@sql) Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
|
|
|