Link to home
Start Free TrialLog in
Avatar of wilcon
wilcon

asked on

Is there a way to update a table in another SQL Server Database with data from a combination of two tables in the Main SQL Server Database with a trigger?

I am trying to write a trigger that will allow me to insert data into a SQL Server database table once data is added to the first SQL Server Database.  My problem is that the data needed for the second SQL Server database is in two separate tables in the first SQL Server database?  How do I accomplish this?
ASKER CERTIFIED SOLUTION
Avatar of dqmq
dqmq
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wilcon
wilcon

ASKER

When I insert the data in my main application it will go into two tables.  A combination of data from those two tables will need to be inserted into one table in a different database.  It doesn't look like this handles that?  Can you give further explanation?
Do the two inserted rows have a parent-child relationship?  It's probably the primary key of the single table on the other database.  Put the trigger on the second table to receive the insert (should be the child table) and the trigger I described should work.

If not, please post the structure of the three tables so that I can better understand.
Avatar of wilcon

ASKER

OK, I'll try this.