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
 General SQL Server Forums
 New to SQL Server Programming
 Populating 2 tables using flat file

Author  Topic 

jigsatics
Starting Member

18 Posts

Posted - 2005-12-12 : 18:42:14
Hi!

I'm trying to setup a DTS that reads a flat file uses a Data Driven Query task and then selects ONLY records that does not exist in the database and then INSERT them to DB1.

This works fine but I need to add another functionality.

I need to create a record on another table(DB2) based on the freshly inserted records in DB1 using only some of the fields. How do I do it?

Is setting up a trigger possible so that everytime a record is inerted in DB1 it will automatically a populate DB2?

Flat file:
ID
Name
Phone

DB1
ID
Name
Phone

DB2
ID
PHone
Event (from 00 to 10)
NumActions (initialized to 0)

Please help.

Thanks.


$3.99/yr .COM!
http://www.greatdomains4less.com

SreenivasBora
Posting Yak Master

164 Posts

Posted - 2005-12-15 : 10:33:47
Write a trigger on database DB1 of Table T1 to Insert the new records into Databse DB2 of Table T1.

Capture new records from magic tables Inserted and updated data from Deleted (If required).

:-)

With Regards
BSR
Go to Top of Page

jigsatics
Starting Member

18 Posts

Posted - 2005-12-15 : 10:36:37
Thanks. That solved it!


$3.99/yr .COM!
http://www.greatdomains4less.com
Go to Top of Page
   

- Advertisement -