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)
 SOLVED: SQL 2000 Update Trigger Problem

Author  Topic 

oldclocker
Starting Member

4 Posts

Posted - 2001-06-06 : 11:26:49
Why will the following code pass syntax check in SQL Query Analyzer in SQL 2000 Enterprise, but not run?


-- =============================================
-- 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



Edited by - oldclocker on 06/06/2001 11:39:09

Edited by - oldclocker on 06/06/2001 13:28:04

Edited by - oldclocker on 06/06/2001 13:58:21

Edited by - oldclocker on 06/06/2001 15:11:31
   

- Advertisement -