Insert/Update/Delete Triggers across servers

  • Hi All,

    I'm trying to create a combined Insert/Delete/Update trigger on a table which will update another table on a different server.

    I'm using SQL Server 2000.

    Everything looks fine, but i get the following error when trying to execute a similar select (with server/database prefix) in Query Analyser:

    Server: Msg 117, Level 15, State 2, Line 1

    The number name 'ServerB.DatabaseB.dbo.User' contains more than the maximum number of prefixes. The maximum is 3.

    Below a part of my trigger:

    CREATE TRIGGER User_InsUpdDel ON [dbo].[User]

    FOR INSERT,DELETE,UPDATE

    AS

    Delete from

    [ServerB].[DatabaseB].[dbo].[User]

    Where Exists

    (SELECT * FROM Deleted

    Where

    [ServerB].[DatabaseB].[dbo].[User].[ID] = Deleted.[ID])

    Could someone tell me how to solve this issue ?

    Thanks in advance,

    Peter

  • Try changing the delete query to the following.

    DELETEU

    FROMServerB.DatabaseB.dbo.User U

    WHEREEXISTS( SELECT * FROM deleted d WHERE U.ID = d.ID )

    --Ramesh


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply