Search code examples
sqlsql-serversql-updatelatitude-longitude

How to update the latitude and longitude in SQL Server


UPDATE [Tree_Monitoring_Philips].[dbo].[T_NumberOfTrees]
SET [TreeLatitude] = '18°38'33.8352"',
    [TreeLongitude] = N'73°48'9.85"E' 
WHERE [ID] = 1

How to update the latitude & longitude in SQL server? The latitude and longitude are in degree per minutes seconds and SQL Server is enclosing the update query for minutes as per their defined update query format and does not get work the query.


Solution

  • If you want to use DMS format you should use (''). Here is the example,

    SET [TreeLatitude] = '18°38''33.8352"',
        [TreeLongitude] = '73°48''9.85"E'