This is a discussion on Error converting data type varchar to float within the SQL Server forums, part of the Microsoft SQL Server category; --> I have created a stored procedure that contain this field (below) in order to meet certain criteria. But my ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have created a stored procedure that contain this field (below) in order to meet certain criteria. But my problem is when I try to run the stored procedure I encounter an error "Error converting data type varchar to float". CASE Final WHEN 0 THEN '--' ELSE Final END AS FinalGrade The Final field is a float data type. Could anyone teach me how to fix this problem? |
| ||||
| Hi JayPee You case statement is illegal because '--' is actually a varchar. what do you want the return to be ? what is the function. you could cast final as varchar and then return something like when '0' then '--' else cast(final as varchar) or if you need to keep it as float, i suggest putting null instead of '--' and then running is_null on that. hope this helps Tzvika |