CREATE TRIGGER Deleted_Products ON [scheme].[stockm]
FOR Update
AS
Declare @product VARCHAR(10)
Declare @description varchar(1000)
Declare @pickface varchar (10)
Declare @body varchar(2000)
Declare @Status varchar(100)
if not update (analysis_c)
begin
return
end
if not exists( select null from inserted where analysis_c = 'DELETED')
begin
return
end
Select @product = product,
@description = description,
@pickface = packaging,
@Status = analysis_c
from inserted
set @body = ('Product' + ' ' + @product + @description + ' ' + 'has been moved to' + ' ' + @Status + 'Pickface' + ' ' + @pickface)
EXEC master..xp_sendmail
@recipients = '[email protected]',
@subject = 'Product Information Updated',
@message = @body
|