我有以下SP,
MERGE INTO DeviceCatalog DC
USING (SELECT @UniqueID AS UniqueID) T ON (DC.UniqueID = T.UniqueID)
WHEN MATCHED THEN
UPDATE
WHEN NOT MATCHED THEN
INSERT
WHEN NOT MATCHED THEN
IF(Condition)
BEGIN
EXEC DeleteDeviceID;
END;
我不知道如何使这项工作?请帮忙
更新:我能够做到这一点,
MERGE INTO DeviceCatalog DC
USING (SELECT @UniqueID AS UniqueID) T ON (DC.UniqueID = T.UniqueID)
WHEN MATCHED THEN
UPDATE
WHEN NOT MATCHED THEN
INSERT
WHEN NOT MATCHED THEN
DELETE WHERE [UniqueID] = @OldUniqueID;
END
但只有删除语句在抱怨。