I'm writing an INSERT TRIGGER that is giving me the error:
Msg 7405, Level 16, State 1, Procedure RI_ReportInfo_ITrig, Line 40
Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.
The trigger looks like this:
DECLARE @RefNumFound INT;
SET @RefNumFound = (SELECT COUNT(*) FROM CorsairFM.FM.dbo.WORKOBJ wo -- linked table
WHERE wo.RefNum = CAST(dbo.RemoveChars(inserted.RIMediaNumber) AS BIGINT)) -- clean all non-numeric character from RIMediaNumber
IF(@RefNumFound != 1) -- if we find more than 1 match in the linked table something is wrong with users inputted data
RAISERROR(778429, 16, 1)
I can't seem to find the problem. Can you help?