Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Triggers - Access Another Database

Status
Not open for further replies.

anonim1

Programmer
Dec 10, 2004
108
US
I have two databases, and I have created three triggers for INSERT, DELETE, and UPDATE.

Basically, anytime a record is inserted, deleted, or updated from the database where I have the trigger, the trigger makes this change in another database.

Here is the code for INSERT:

CREATE TRIGGER trg_Test ON tbl_User
FOR INSERT
AS

INSERT INTO DatabaseTwo.dbo.tbl_User
SELECT id, email, password FROM INSERTED

PRINT 'User(s) added.'

The trigger works flawlessly if I go into Query Analyzer and execute a T-SQL statement to insert a new record. However, when I insert a record using the ASP page that will be used to insert new users, I get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'DatabaseTwo.dbo.tbl_User'.

Any ideas?
 
Just realized that I renamed tbl_User in DatabaseTwo and forgot to update my triggers. All's working now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top