Hello,
I need a little help with trigger, I have been doing database development for a long time now but this is my first go around at a trigger. It is not working, can someone please look at this and let me know what I am doing wrong:
ALTER TRIGGER [dbo].[Trigger_Insert_Portal] ON [eos2].[dbo].[Visits]
AFTER INSERT
AS
BEGIN
INSERT INTO [MT_PHMWebEnrollment].[dbo].[Enrollments] ([placeholderEmail]
,[patientFirstName]
,[patientLastName]
,[patientDateOfBirth]
,[patientGender]
,[patientMRN]
,[patientLocation]
,[status])
SELECT 'UNKNOWN',[eos2].[dbo].[Patients].[firstName]
,[eos2].[dbo].[Patients].[lastName]
,[eos2].[dbo].[Patients].[dateOfBirth]
,[eos2].[dbo].[Patients].[gender]
,[eos2].[dbo].[Patients].[medicalRecordNumber]
,INSERTED.[hospitalService]
,'UNKNOWN'
FROM INSERTED
JOIN [eos2].[dbo].[Patients]
ON INSERTED.[patientAuid] = [eos2].[dbo].[Patients].[patientAuid]
where INSERTED.[patientClass] = 'I'
AND INSERTED.[facilityMnemonic] = 'KCH'
END
Please give me any feedback possible. Thank you very much.