Error converting data type varChar to Float

  • Hello Everyone,

    I am running a really big code. At some point, I am getting an error "Msg 8114, Level 16, state 5, Line 1 error converting data type varchar to float."

    I am not able to identify the error at all.

     

    Please help.

  • Can you post more information?

    What I expect you are doing is something like:

    SELECT *
    FROM <TABLE>
    WHERE <COLUMN> = 12.3

    If that is the case, double check the datatype of <COLUMN>.  Based on that error, I am pretty sure that it is VARCHAR and you are comparing it to a FLOAT.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • You have an implicit or explicit conversion taking place. Somewhere your code is trying to cast data to float, and there are values in the varchar field that cannot be CAST() that way. You will have to look through the code for a place where you are converting or using a function/operator on a field that contains float data.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply