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
 Transact-SQL (2000)
 Triggers applied against multiple databases

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-08 : 17:06:33
Rob writes "Do you know how to design a trigger that, when fired after an INSERT or UPDATE against a table in the database, will INSERT/UPDATE that same data to a similar table in a separate database?

I have only experimented with triggers within one database. Would really appreciate your help."

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-08 : 17:14:55
You just need to use the three part naming convention of the table in the destination database.

INSERT INTO SomeDb.dbo.SomeTable(...)
SELECT ...
FROM inserted
...

Tara
Go to Top of Page
   

- Advertisement -