locked
Error converting data type varchar to float. RRS feed

  • Question

  • Hi All,

    I have stored procedure which does the Safe record and not safe record by using currsor.

    This same stored procedure is working fine the SQL 2000 version after migrating to SQL server 2008 i am facing the Below ERROR :

    Procedure usp__Safe_unsafe_record, Line 478
    Error converting data type varchar to float.

    Can any one Please let me know what would be the issue.

    Thanks in Adavance,

    Thanks,

    Anil


    • Edited by anilmarnal Sunday, April 20, 2014 9:59 AM
    Sunday, April 20, 2014 9:57 AM

Answers

  • Hello Anil,

    Seems in code line 478 of the SP there is a conversion from varchar to float value, which fails, because maybe a non-numeric should be converted. Check the code of your stored procedure and the value for converting.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Sofiya Li Tuesday, April 22, 2014 5:49 AM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:41 AM
    Sunday, April 20, 2014 11:10 AM
  • I don't have the code of the stored procedure and so I can't lookup the code line which throws the error.

    It could be an explicit conversion with the CAST or CONVERT function or an implicit conversion, e.g. a column compare where the columns have different data types.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Sofiya Li Tuesday, April 22, 2014 5:49 AM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:41 AM
    Monday, April 21, 2014 1:42 PM

All replies

  • Hello Anil,

    Seems in code line 478 of the SP there is a conversion from varchar to float value, which fails, because maybe a non-numeric should be converted. Check the code of your stored procedure and the value for converting.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Sofiya Li Tuesday, April 22, 2014 5:49 AM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:41 AM
    Sunday, April 20, 2014 11:10 AM
  • Thanks Olaf Helper,

    Exactly it is saying line 478 of the SP is a conversion from varchar to float Value ,

    but here i am unable to find out which column is trying to convert  varchar to float value.

    Can you suggest me is there any short cuts to find out the which columns causing failure convert.

    Thanks,

    Anil


    -Thanks Anil

    Monday, April 21, 2014 11:07 AM
  • post your table structure and the Query please
    Monday, April 21, 2014 12:24 PM
  • Thanks Olaf Helper,

    Exactly it is saying line 478 of the SP is a conversion from varchar to float Value ,

    but here i am unable to find out which column is trying to convert  varchar to float value.

    Can you suggest me is there any short cuts to find out the which columns causing failure convert.

    Thanks,

    Anil


    -Thanks Anil


    Unfortunately no. You've to check each expression/ column involved to see if there's and explicit/implicit conversions happening

    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

    • Proposed as answer by Sofiya Li Tuesday, April 22, 2014 5:49 AM
    Monday, April 21, 2014 12:41 PM
  • Thanks Visakh,

    What is the alternate for this ?

    how to resolve this any ideas or any simplification ?

    Please help me out ...

     Hi Olaf Helper

    Any suggestions ....regaring my question ?


    -Thanks Anil

    Monday, April 21, 2014 1:21 PM
  • I don't have the code of the stored procedure and so I can't lookup the code line which throws the error.

    It could be an explicit conversion with the CAST or CONVERT function or an implicit conversion, e.g. a column compare where the columns have different data types.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Proposed as answer by Sofiya Li Tuesday, April 22, 2014 5:49 AM
    • Marked as answer by Sofiya Li Tuesday, April 29, 2014 3:41 AM
    Monday, April 21, 2014 1:42 PM