- Insert, Update, Delete
Example using FOR and deleted :
CREATE TRIGGER Save_Deleted_records
ON dbo.able_Test
FOR DELETE
AS
INSERT deleted_records_mark
SELECT * FROM deleted
more on microsoft Web Site:http://msdn.microsoft.com/en-us/library/ms190739(SQL.90).aspx
Create TRIGGER dbo.UpdateTrigger ON dbo.Table3
AFTER INSERT AS
BEGIN
SET NOCOUNT ON;
declare @ticket as varchar(8)
set @ticket = (select callid from inserted)
update subset set uticketrem = @ticket where custtype<>'Facility' and callid=@ticket
END
- Instead of Insert, Update, Delete
CREATE TRIGGER Example_Trigger on Table1
INSTEAD OF INSERT
AS
BEGIN
-- Instead of inserting you can do other operations
INSERT INTO Table45
SELECT RowMatCol, Date_Doc
FROM inserted
END
More on Microsoft Web Site here: http://technet.microsoft.com/en-us/library/ms175089.aspx
Happy Christmas and an Happy New Year
Sponsored by IT Tech BuZ
2 Responses to “SQL Trigger”
thats very good, i like it. . .
hi from mas raden
Im also about to learn about integrating SQL with my Visual Foxpro in Database Management System. I hope you won't mind sharing me some tips.
Check out my Site KuLaz : Daily Dose of Fun and Facts. Do the clicking and i would be willing to reciprocate it unto yours.
Post a Comment