I'm attempting to create a CASE
when my @ReportId = A
then return a list of values. Else @reportId = @reportId
I've attempted to wrong around this by possibly listening every condition but this issue is that I would like all of these ids returned when @ReportId = 'A'
How can I achieve this in my SQL Case?
SELECT RT.ReportTitle, RT.ReportCode, RT.ReportID,
FROM dbo.reportTitles As RT
WHERE LEFT(RT.ReportCode, 2) =
CASE
WHEN @ReportID= 'A' THEN (01, 02, 03, 04, 05, 06, 07, 08, 09)
ELSE @ReportID
END
ORDER BY RT.ReportTitleASC
My expected outcome would be to Select from dbo.reportTitles
Where @ReportId
are LIKE the list of ids when @ReportID = 'A'
If it is not 'A'
I'd like it to be using the original value that ReportID
is.