Problem in removing hardcoded values using temp table...

Posted by Shahsra on Stack Overflow See other posts from Stack Overflow or by Shahsra
Published on 2010-12-31T21:38:10Z Indexed on 2010/12/31 22:54 UTC
Read the original article Hit count: 155

Filed under:
|
|

Hi All,

First of all Wish u all Happy New Year. I have a problem in writing query. While executing my query I am getting an error.

Query:

select case 

when S.R1 = '6' then 5

when S.R1 =  '7' then 6

when S.R1 = '8' then 7

when S.R1 = '9' then 8

when S.R1 ='10' then 9 

else S.R1 end as Q

FROM [HelpService].[dbo].[help] s
-----------------------------------------------

SELECT [Source], [Score] 

INTO #Temp_Q

FROM [HelpDesk].[dbo].[Survey] 

WHERE [data_Source Name] = 'Text Data'

-----------------------------------------------

select CONVERT(REAL, a.[Dell Score]) as Q

FROM [HelpService].[dbo].[help] s

LEFT OUTER JOIN #CE_Temp_Q a on

s.[R1] = a.[Source]

ERROR

Msg 8114, Level 16, State 5, Line 1

Error converting data type varchar to real.

What I am asked to do is I need to remove the hard coded values and need to write queries with a temp table.

Thanks in Advance, Shashra

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server