fiogf49gjkf0d Jacob:
You never posted your actual error when adding the Trigger.
I added it to an Eval DB on my end, and realized what you may be doing wrong.
I debugged the Trigger, and this line was always failing on me:
IF (SELECT TICKET.CREATEUSER()) = 'UBQHXA00300P'
This syntax is not working for me, so instead I just used the following:
This is what I did instead (Keep in mind that the INSERTED recordset could have more than one record at a time, so it is typically better to use a CURSOR to loop through it, but this may sufficient if tickets are created one at a time):
<p>CREATE TRIGGER SLX_Portal_Ticket ON TICKET AFTER INSERT AS BEGIN
SET NOCOUNT ON
DECLARE @CreateUser AS CHAR(12) SELECT @CreateUser = CREATEUSER FROM INSERTED
IF @CreateUser = 'UBQHXA00300P' BEGIN EXEC msdb.dbo.sp_send_dbmail @profile_name='slxportal', @recipients='email@domain', @subject = 'SLX Ticket Has Been Created' END SET NOCOUNT OFF END
|