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
 General SQL Server Forums
 New to SQL Server Programming
 Writing a Trigger

Author  Topic 

tohariganesh
Starting Member

1 Post

Posted - 2008-11-13 : 07:55:19
Friends

I am new to SQL.
Please help in writing a trigger in SQL server.

I have a table called ams_attendance in amsmum database. whenever the table gets inserted/updated i want the updated/inserted entries to be replicated in ams_attendance in amsggn database.


Please help me.Thanks

HG

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-11-13 : 08:26:04
CREATE TRIGGER [trg_Insertams_attendance ]
ON ams_attendance
AFTER INSERT
AS
BEGIN

INSERT INTO amsggn.ams_attendance (colomns)
SELECT columns FROM INSERTED


END
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-13 : 08:46:35
quote:
Originally posted by lionofdezert

CREATE TRIGGER [trg_Insertams_attendance ]
ON ams_attendance
AFTER INSERT,UPDATE
AS
BEGIN

INSERT INTO amsggn.ams_attendance (colomns)
SELECT columns FROM INSERTED


END



if you have to track updates also.
Also i guess amsmum and amsggn databses are in same server.
Go to Top of Page
   

- Advertisement -