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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update Trigger Question

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-12 : 09:19:04
Chris writes "Why will the following code not pass syntax check in SQL Query Analyzer in SQL 2000 Enterprise?


-- =============================================
-- Create trigger contained If UPDATE(column)
-- =============================================

IF EXISTS (SELECT name
FROM sysobjects
WHERE name = N'aog_alert'
AND type = 'TR')
DROP TRIGGER aog_alert
GO

CREATE TRIGGER aog_alert
ON AOG_list for UPDATE
AS
if inserted.status=1
BEGIN
select status,[tail],[description] from inserted as i
select status,[tail],[description] from deleted as d
declare @textsub varchar(40)
declare @mymess varchar(1000)
declare @tail varchar(5)
set @tail=[i.tail]
set @mymess=[i.description]
set @textsub='Aircraft '+ @tail +' AOG Alert Notice'
exec xp_sendmail @recipients='ccombs@midwayair.com',@message=@mymess,@subject=@textsub
END
GO"
   

- Advertisement -