Когда я использую оператор MERGE
, я получаю ошибку "неверный синтаксис":
MERGE ResponsibleLawyers AS RL
USING @tempPerson AS TP ON RL.ResponsibleLawyerID = TP.ResponsibleLawyerID
WHEN MATCHED THEN
UPDATE
SET RL.FirstName = TP.FirstName,
RL.LastName = TP.LastName,
RL.AccountName = TP.AccountName,
RL.EmailAddress = TP.EmailAddress,
RL.Region = TP.Region,
RL.Active = TP.Active
WHEN NOT MATCHED BY RL THEN
INSERT (ResponsibleLawyerID, FirstName, LastName, AccountName, EmailAddress, Region, Active)
VALUES (TP.ResponsibleLawyerID, TP.FirstName, TP.LastName, TP.AccountName, TP.EmailAddress, TP.Region, TP.Active)
WHEN NOT MATCHED BY SOURCE THEN
DELETE
Я получаю ошибку "Неверный синтаксис" рядом с "RL".Я использую 110 уровень совместимости на SQL Server 2012. Кто-нибудь знает, что не так?
WHEN NOT MATCHED BY RL THEN