Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Convert GPS from Decimal To DMS

By vevoda.ulath,

Greetings. Just simple script, which someone can find handy. It will do exactly as description said - convert GPS from decimal format to format known as DMS (date-minute-second) .

There are two paramatres

  • @decimalGPS is decimal(20,8) value containg decimal GPS coordinates
  • @isLongitude is bit value expressing whether we are dealing with latitude or longitude

I believe script is self-explaining. The queries are separated, althought they could be probablly shrinked into one, but i preffer readibillity of script before having all written in one row.


Simple example:

SELECT dbo.gpsConvertDecimalToDMS(50.4942,0), dbo.gpsConvertDecimalToDMS(14.4481,1) /* 50°29'39.12'' 14°26'53.16'' */


Total article views: 829 | Views in the last 30 days: 2
Related Articles

Script to calculate Precision & Scale of a Decimal Value

A script to help you find the Precision & Scale parts of a decimal value.


decimal issue

decimal issue


Select Decimal

Need Decimal() function


Decimal Truncation in division

Decimal Truncation in division


Decimal Truncation in division

Decimal Truncation in division

math functions    

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones