>Hi all!
>
>I have an SQL database that is set up to store Latitude and Longitude in a Varchar field. I need to convert the Varchar to a float or decimal in a view. I am not having any luck using cast or convert to make the change can anyone suggest a way to make this happen? The data in the Varchar field looks like this 95.12345 for Latitude and -68.12345 for Longitude.
>
>Thanks!
>
>Jim Harvey
To get errors you should have some values in these fields which can't be converted to some of numeric types. Check your table for such values:
SELECT * FROM YourTable WHERE ISNUMERIC(Latitude+'e2') = 0 OR ISNUMERIC(Longitude+'e2') = 0
I added +'e2' just because '1e2' can be numeric in SQL Server. But this: '1e2e2' can't :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.