Discussion Locked

SQL server 7 trigger

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
how can I enforce a trigger created in a table in database X, and the affected table will be in database Y..

9 replies

by pvp

Your question is a bit terse, but...

If you're trying to verify x.table against y.table, the trigger on x.table can do that easily.

If you're trying to ensure the integrity of y.table, you need a trigger (maybe even the same one, or with minorchanges) on y.table.

Remember, triggers are invoked by *attempted* operations on a table, and operations on y.table will not invoke the trigger on x.table *unless* y.table has a trigger that (a) invokes the x.table trigger or (b) does some operation on x.table.

by roc180

I think you want to know how to cross databases. If thats the case in your database X table x1 trigger code make sure you fully qualify the table y1 in database Y. To fully qualify table y1 use the syntax Y.dbo.y1 in your SQL. If Y is on a different server you will also have to include the server name or its alias.

Neal Martinelli

by john_bosko

while creating a trigger on a table in the database X please specify a stored procedure that would go and do the affect in another tabee in database Y.

This discussion is closed to new replies.