Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Triggers 1

Status
Not open for further replies.

ADW

Programmer
Jun 21, 2001
50
GB
Hello,
I want to select all columns within a table on an update trigger but I can't figure out how to select more than 1? Anybody help?
CREATE TRIGGER [AGE] ON [Employees]
FOR INSERT, UPDATE
AS

declare @tempage datetime
declare @tempemp varchar(30)
declare @tempstring varchar(50)

if update (????)
BEGIN select @tempage = (select * from Inserted)
begin
select @tempemp = (Select FirstName from Inserted)
select @tempstring = 'Mail notification of an update using atrigger - tony' + @tempemp
exec master.dbo.xp_sendmail
'tony.whitwell@decorpart.co.uk' ,@tempstring

end
end
 
hi ADW,
Sorry, i am very good in english. I had not understand by "I want to select all columns within a table on an update trigger".
If you want to check the update criteria on all of the columns you can use
IF UPDATE(COLUMN1) OR UPDATE(COLUMN2) OR ...
You can use OR or AND depending on your criteria.

If this is not "what you require?", Please explain your requirement a little more.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top