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?
Microsoft SQL Server 2005

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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.

OK, I'll try this.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck