Saturday, December 20, 2008

Error converting data type varchar to float

Error converting data type varchar to float

Solution:
use isNumeric() to check if it's a numerical value. If it is, then continue checking next condition :)

Use the ISNUMERIC function to make sure the data is numeric before doing your comparison.

Be aware that 1e4 is a valid number in scientific notation as well as 1d2, etc.


select * from TT
where ISNUMERIC(field_name)=1
AND CAST(field_name as float) > 2.5


isNull() is useful as well

isNull( field_name, '0' )

1 comment:

Anonymous said...

I think that you may be interested in another application that quickly eliminates data corruption issues in database files, please take a look at data base corrupt file to recover foxpro tool and let me know what do you think