ALTER TRIGGER [dbo].[Trigger_tbl_Process_Constants] ON dbo.tbl_Process_Constants
FOR UPDATE
AS
begin
UPDATE dbo.tbl_Process_Constants
SET Date_Modified = GETDATE()
end
Result: Its update all rows of a table.
So basically something like:
Sending a mail using Trigger:
update anu_items set items_Amount=400 where items_id=1
exec master..xp_sendmail
@recipients='abc@gmail.com',
@message='Body',
@subject='subject Text'
FOR UPDATE
AS
begin
UPDATE dbo.tbl_Process_Constants
SET Date_Modified = GETDATE()
end
Result: Its update all rows of a table.
So basically something like:
CREATE TRIGGER [dbo].[Trigger_tbl_Process_Constants] ON dbo.tbl_Process_Constants FOR UPDATE AS BEGIN UPDATE dbo.tbl_Process_Constants SET Date_Modified = GETDATE() WHERE keycolumn IN ( SELECT keycolumn FROM inserted ) ENDAlso - just to avoid recursive trigger calls - (stealing Andras' code)
CREATE TRIGGER [dbo].[Trigger_tbl_Process_Constants] ON dbo.tbl_Process_Constants FOR UPDATE AS BEGIN IF not(update(Date_Modified)) BEGIN UPDATE dbo.tbl_Process_Constants SET Date_Modified = GETDATE() WHERE keycolumn IN ( SELECT keycolumn FROM inserted ) END END
Sending a mail using Trigger:
update anu_items set items_Amount=400 where items_id=1
exec master..xp_sendmail
@recipients='abc@gmail.com',
@message='Body',
@subject='subject Text'
No comments:
Post a Comment