SQL Server: Error converting data type varchar to float

前端 未结 2 454
悲哀的现实
悲哀的现实 2021-01-28 10:05

I have the following SELECT statement to calculate RADIANS and COS.

SELECT COS(RADIANS(latitude)) as Lat 
FROM tbl_geomet         


        
2条回答
  •  迷失自我
    2021-01-28 10:46

    Use try_convert() to find the invalid data:

    select latitude
    from tbl_geometry
    where try_convert(float, latitude) is null;
    

    try_convert() is available in SQL Server 2012+.

提交回复
热议问题