手順では、以下のようなステートメントがあります
declare @mnth int
select @mnth=month(cast('08/12/2013' as datetime))
if( @mnth<7)
begin
--some statements
end
else
begin
--some other statements
end
エラーが発生しています
キーワード「else」付近の構文が正しくありません。
何が悪いのか理解できません。助けてください
手順では、以下のようなステートメントがあります
declare @mnth int
select @mnth=month(cast('08/12/2013' as datetime))
if( @mnth<7)
begin
--some statements
end
else
begin
--some other statements
end
エラーが発生しています
キーワード「else」付近の構文が正しくありません。
何が悪いのか理解できません。助けてください
BEGIN
とEND
blockの間にいくつかのステートメントが必要です。コメントは許可されていません。
declare @mnth int
select @mnth=month(cast('08/12/2013' as datetime))
if( @mnth<7)
begin
DECLARE @Dummy bit
--some statements
end
else
begin
DECLARE @Dummy2 bit
--some other statements
end
次のコードで試してください
declare @mnth int select @mnth=month(cast('08/12/2013' as datetime)) BEGIN if( @mnth<7) begin
PRINT 'IF'
end else begin PRINT 'else' end END