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 |
Pat Shaw
Starting Member
14 Posts |
Posted - 2006-09-15 : 06:20:40
|
I need to move certain tables from database A to database B on the same server. Can anyone advise me of the best or easiest way to do this please.Thanks. |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-15 : 07:02:58
|
1. DTS2. BCP3. BULK INSERT4. Script tables in one db and run the script in the destination database to create tables and use Insert...Into statement to populate dataHarsh AthalyeIndia."Nothing is Impossible" |
 |
|
anilkdanta
Starting Member
25 Posts |
Posted - 2006-09-15 : 07:17:42
|
You can use 'Export Data' wizard to do this. Select the Source and Destination databases, select all the tables you wanted to move. Verify their names on the Destination column. It should be same always.This will create the tables on the destination if it does not exist, and then copies the data. Otherwise just copies the data.If the data in the tables are huge, You will have to do the same thing using DTS package. Hope you are familiar with DTS. Refer the HELP docs. |
 |
|
Kristen
Test
22859 Posts |
Posted - 2006-09-15 : 07:28:06
|
I would suggest you script the tables from the Source database and pre-create them on the Target database - then transfer the data using DTS etc. DTS will include most of the structure of tables if it creates them on the fly, but not indexes, FKs, etc.Also, if you have referential integrity on your tables you can choose NOT to create the FKs initially, but leave that part of the Build Script until after you have transfered the data, and then you won't have to be picky about the [DEPENDS] order you import the tables and so on.A suitable Build Script will also have a DROP TABLE section - which will be handy if something goes wrong the first time and you need to tear the tables down and start again! (but be careful you don't accidentally delete a table that already exists in teh Target database!!)Kristen |
 |
|
anilkdanta
Starting Member
25 Posts |
Posted - 2006-09-18 : 07:24:33
|
Yes, this is the right way to do this stuff. |
 |
|
|
|
|