I am getting an error while eleminating the hard coded values.
Instead of this case statement I need to write simple select statement...using temp tables...
select case [BVG]
when 1 then 1
when 2 then 2
when 3 then 3
end as Q0,
SELECT CASE [AVG]
when 1 then 1
when 1.33 then 2
when 1.5 then 2
when 1.67 then 3
when 2 then 3
when 2.33 then 4
End as Q
FROM [MS].[BE].[Survey]
So I have written a code using temp table.....
SELECT [Source], [Score]
INTO #Temp_Table
FROM [MS].[dbo].[S_Survey]
WHERE [data_Source] = 'USA'
Instead of that case statement I am replacing this select statement....
SELECT q.[Score] as Q --- Getting error in this place.Data Type is varchar (100).
FROM [MS].[BE].[Survey] s
LEFT OUTER JOIN #Temp_Table q on
s.[AVG] = q.[Source]
But I am getting an error while executing.... And the error is
Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar to float.
Instead of that place near q.[score] as Q what can I write.... and how can I write the syntax...
Thanks, Sahsra