I hope someone can help because I'm lost as to what the problem is...
I have created a trigger:
CREATE TRIGGER new_contact
declare @contact_id varchar(11)
declare @body varchar(2000)
declare @staff_issued varchar(10)
SELECT @contact_id = contact_id,
@staff_issued = staff_issued
SET @body = 'Customer with ID:' + @conatct_id + ' has been created by: ' + @staff_issued
@recipients = 'firstname.lastname@example.org',
@subject = 'New Customer',
@body = @body
and then I run:
INSERT INTO contacts
(contact_id, date_issued, staff_issued)
VALUES ('ABC12345678', GETDATE(), 'ADMIN')
The insert works, the triggers runs and emails me but it sends the top result from the table "contacts" rather than the one that has just inserted???
I am obviously missing something.
Can anyone point me in the right direction??
Many Thanks in advance