ganesh.khuspe_v (4/2/2014)
Hi all,following is my trigger:
CREATE TRIGGER trigger1 ON Table1 after Update AS
begin
INSERT INTO table2
SELECT * from inserted
end
in above Query i want to add record from inserted table to table2 which is on another Database2.
and Table1 is in Database1.
After Updating Database1.Table1 trigger should get fire and record get inserted into Database2.Table2.
How can we do this????
you need to do the following
CREATE TRIGGER trigger1 ON Table1 after Update AS
begin
INSERT INTO [Database2].[schema].table2(ID, Name) ---- this is required otherwise will get error.
SELECT ID, Name
from inserted
end
and table2 must exists in the Database2 on the same sql server.
hope it helps