「T-SQL」論理演算子の論理積(AND)のサンプル
書式
if (左の条件式) AND (右の条件式)
使用例
CREATE PROCEDURE dbo.SAMPLE AS BEGIN DECLARE @flgA INT DECLARE @flgB INT DECLARE @val VARCHAR(15) SET @flgA = 1 SET @flgB = 0 IF (@flgA = 1) AND (@flgB = 0) SET @val = 'AAA' ELSE SET @val = 'BBB' PRINT @val END
実行結果
AAA