Hi,
Can anyone help me set up our RMS version 2.0.2000 so that when a sale happens over a certain amount, it sends an email? I did get the emails to send, but it started messing with the transaction numbers (setting them to random numbers such as '1' and '4') and I can't figure out why. I'll enter the code I used to create the trigger below.
Thanks!
IF OBJECT_ID ('SaleNotify') IS NOT NULL DROP TRIGGER SaleNotify GO CREATE TRIGGER SaleNotify ON [Transaction] AFTER INSERT AS BEGIN SET NOCOUNT ON DECLARE @total money DECLARE @tsalestax money SELECT @total = Total FROM inserted SELECT @tsalestax = SalesTax FROM inserted IF(@total >= 2000.00) BEGIN declare @body1 varchar(max) set @body1 = '[Store] has made a sale in the amount of $' + CAST((@total - @tsalestax) as varchar(max)) EXEC msdb.dbo.sp_send_dbmail @recipients='[emails]', @subject = 'Sale Made - [Store]', @body = @body1, @body_format = 'HTML' ; END END