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 |
|
Shrews14
Starting Member
37 Posts |
Posted - 2007-02-02 : 04:36:36
|
| Hi,wondering if anybody could help i wondered if there is a way i could loop through a number of tables and append them to a new database at the moment, i'm writing a SQL statment for each table and when there's about 50 this becomes slightly tedious......this is my SQL statment in a SP,INSERT INTO DB2.dbo.datatable1SELECT *FROM DB1.dbo.datatable1;INSERT INTO DB2.dbo.datatable2SELECT *FROM DB1.dbo.datatable2;...Is there a way to loop?? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-02-02 : 04:44:26
|
| Why don't you use more sophisticated tools like BCP or DTS to transfer the data rather than doing it manually?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Shrews14
Starting Member
37 Posts |
Posted - 2007-02-02 : 04:54:39
|
| One i'm learning to use SProc's and Two this produre will have to be run a number of times a month and i didn't know i could append data into tables using DTS or BCP. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-02-02 : 05:28:34
|
| One, This is not a best example to learn SPsTwo, You can schedule jobs or DTS packages to run repeatitivelyThree, by trying to write this SP, you are making simple task unnecessarily complicated.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|