IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'X' AND COLUMN_NAME = 'Y')
IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Z' AND COLUMN_NAME = 'A')
BEGIN
UPDATE [dbo].[X]
SET Y= (SELECT inst.[A] FROM [dbo].[Z] s WHERE s.[B] = [dbo].[x].[B]);
END
GO
我想结合 2 个 IF 条件并仅在它们都满足时才执行更新。如果存在的话,有什么方法可以让我加入俱乐部 2 吗?