Hi,
I am struggling to understand what is wrong with the following...
DECLARE @YEAR as varchar(4);
DECLARE @MONTH as varchar(4);
SET @MONTH = MONTH(DATEADD(M,1,GETDATE()));
CASE @YEAR
WHEN @MONTH == '12' THEN '2011';
ELSE YEAR(GETDATE());
END
I receive the following error...
"Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'CASE'."
Any suggestions please?
I am struggling to understand what is wrong with the following...
DECLARE @YEAR as varchar(4);
DECLARE @MONTH as varchar(4);
SET @MONTH = MONTH(DATEADD(M,1,GETDATE()));
CASE @YEAR
WHEN @MONTH == '12' THEN '2011';
ELSE YEAR(GETDATE());
END
I receive the following error...
"Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'CASE'."
Any suggestions please?