Robinstwitcher
Programmer
I have the following code which returns "Incorrect syntax near the keyword 'THEN'." Please advise me on my errors!
declare @ImportTblAP nvarchar (2),
@ImportTblFY nvarchar (2),
@FYSTRING nvarchar (10),
@ModAPFY nvarchar (12)
select @ImportTblFY = rtrim(max(FY)),@ImportTblAP = rtrim(Max(AP))
from DBATblTempImport
SELECT @ImportTblFY =
CASE
WHEN '07' THEN @FYSTRING = '2006/07 AP'
WHEN '08' THEN @FYSTRING = '2007/08 AP'
WHEN '09' THEN @FYSTRING = '2008/09 AP'
WHEN '10' THEN @FYSTRING = '2009/10 AP'
ELSE 'Unknown'
END,
select @MODAPFY=@FYSTRING+@ImportTblAP
BEGIN
print @modapfy
END
declare @ImportTblAP nvarchar (2),
@ImportTblFY nvarchar (2),
@FYSTRING nvarchar (10),
@ModAPFY nvarchar (12)
select @ImportTblFY = rtrim(max(FY)),@ImportTblAP = rtrim(Max(AP))
from DBATblTempImport
SELECT @ImportTblFY =
CASE
WHEN '07' THEN @FYSTRING = '2006/07 AP'
WHEN '08' THEN @FYSTRING = '2007/08 AP'
WHEN '09' THEN @FYSTRING = '2008/09 AP'
WHEN '10' THEN @FYSTRING = '2009/10 AP'
ELSE 'Unknown'
END,
select @MODAPFY=@FYSTRING+@ImportTblAP
BEGIN
print @modapfy
END