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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Import into several tables...

Author  Topic 

danielc
Starting Member

49 Posts

Posted - 2006-08-01 : 15:54:31
Hello folks,

I have a database with one table importing the values into another database. My question is:

What is the best approach to importing the data for db1 into db2 when the values from db1 have to go to several tables in db2? Would i have to use several Transform Data Tasks?

Thank you in advance for your suggestions...

Daniel

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-08-01 : 18:07:56
You don't need to use DTS if the db's are of the same type on the same server. You can do:
INSERT INTO db1..table1 (fields....)
SELECT fields....
FROM db2..table1
WHERE ....


And if the db's aren't on the same server, you can link them then use a similar syntax to the above.
Of course, all this is dependant on the login you're using to have permissions on both db's.

HTH,

Tim
Go to Top of Page

danielc
Starting Member

49 Posts

Posted - 2006-08-01 : 18:36:40
Tim,

Thanks for the reply. But we are hoping to take advantage of the DTS feature.

The source db1 (only one table that gets populated) contains 46 columns and what we are attempting to accomplish is update our destination db2 (which has several tables). I think it would be a little cumbersome to create the insert query and not use the error handling that DTS has to offer.

Tahnks,

Daniel
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-08-01 : 18:49:27
I would disagree.
DTS is handy for interfacing to non-like datasources (text files, other RDBMS's), but if you're dealing with two db's of the same type and location, it would be easier (and I would guess quicker) to do things using a nicely built stored proc. You can implement error handling in there too and they are easier to debug.
But it's all down to personal preference I guess...

Tim
Go to Top of Page
   

- Advertisement -