Thanks for the Reply Visakh..
Can we change this Sub Query into Joins ?
Rohan
Yes using LEFT JOIN
But whats the issue with subquery?
CREATE TRIGGER Trg_Codes
INSTEAD OF INSERT
AS
BEGIN
INSERT Codes
SELECT <columns here>
FROM INSERTED i
LEFT JOIN Codes c
ON c.PCode = i.PCode
AND c.GCode = i.GCode
AND c.DCode = i.DCode
AND c.SCode = i.SCode
AND c.CCode = i.CCode
AND (c.EffectiveDate BETWEEN i.EffectiveDate AND i.TermDate
OR c.TermDate BETWEEN i.EffectiveDate AND i.TermDate)
)
WHERE c.PCode IS NULL
END
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c
No comments:
Post a Comment