Can anyone look over the below code and help me figure out why it I am told there is incorect syntac in my frist THEN statment of my CASE stement?
SELECT si.SectionID AS ID,
si.ShortName AS Title,
si.Synopsis AS Descript,
CAST(
CASE
WHEN nc.CategoryName = 'Cinema'
THEN CAST('Section/EditCinema' AS char(18)) AS PageName
WHEN nc.CategoryName = 'Book'
THEN CAST('Section/EditBook' AS char(16)) AS PageName
WHEN nc.CategoryName = 'Merchandise'
THEN CAST('Section/EditMerch' AS char(17)) AS PageName
ELSE CAST('Section/EditGame' AS char(16)) AS PageName
)
FROM dbo.SectionInfo AS si WITH (NOLOCK)
JOIN dbo.NavigationCategories AS nc WITH (NOLOCK)
ON si.SectionID = nc.SectionID
Error:
quote:
Msg 156, Level 15, State 1, Line 7
Incorrect syntax near the keyword 'AS'.