📜  t sql if 存在多个条件 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:31.986000             🧑  作者: Mango

代码示例1
IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'X' AND COLUMN_NAME = 'Y') 
AND 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