[T-SQL]if文を使うサンプル
書式
IF(条件式)
SET
使用例
CREATE PROCEDURE dbo.SAMPLE AS BEGIN DECLARE @nn INT DECLARE @cft VARCHAR(25) SET @nn = 11 IF (@nn = 0) SET @cft = '60' ELSE IF @nn = 11 SET @cft = '68' ELSE BEGIN SET @cft = '99' END PRINT @cft END
実行結果
68
Coding Changes the World
書式
IF(条件式)
SET
使用例
CREATE PROCEDURE dbo.SAMPLE AS BEGIN DECLARE @nn INT DECLARE @cft VARCHAR(25) SET @nn = 11 IF (@nn = 0) SET @cft = '60' ELSE IF @nn = 11 SET @cft = '68' ELSE BEGIN SET @cft = '99' END PRINT @cft END
実行結果
68