Hi Reader!I currently have the below case statement: SELECT CASE Score1 WHEN '1' THEN 'Integer' WHEN '2' THEN 'Currency' WHEN '3' THEN 'Date' ELSE 'Not Used' END FROM tblScoreDescription WHERE ScoreDescriptionID = @ScoreDescriptionID
What I want to do is set a variable depending on the value of score1. Something like the below: SELECT CASE Score1 WHEN '1' THEN SET @SQL = @SQL + ' (dbo.tblKPIData.KPINumber01) as Result' WHEN '2' THEN SET @SQL = @SQL + ' (dbo.tblKPIData.KPICurrency01) as Result' WHEN '3' THEN SET @SQL = @SQL + ' (dbo.tblKPIData.KPIDate01) as Result' ELSE 'Not Used' END FROM tblScoreDescription WHERE ScoreDescriptionID = @ScoreDescriptionID
Is there any way I can do this?Thanks.