「T-SQL」論理演算子ANDのサンプル

構文
if (左の条件式) AND (右の条件式)

使用例

CREATE PROCEDURE dbo.TEST1
AS
BEGIN
      DECLARE @cftA INT
      DECLARE @cftB INT
      DECLARE @res VARCHAR(20)
      SET @cftA = 22
      SET @cftB = 11

      IF (@cftA = 22) AND (@cftB = 11)
            SET @res = '444'
      ELSE
            SET @res = '555'
            
      PRINT @res 
END

結果
444

SQLServer

Posted by arkgame