Storing Latitude and Longitude in a SQL Server 2005 DB?

OOT
10-30-2007, 02:49 PM
I'm working with SQL Server 2005 and have to store the Lat and Lng for updates coming into the server. I was initially thinking of storing them as VarChars but the Decimal option seems better. I've been searching the forums and either I'm using the wrong keywords or the information isn't posted but what I'm looking for are the maximum values that lat and lng can be? Should I define the data type as Decimal(12,8) or can I go smaller? I just want to make sure that once it's done I won't have to go back and change them so I want to account for whatever the highest/lowest combination is.

Or do you think storing it as a VarChar(12) would be better?

Thanks in advance for any and all help that you can give. It is very much appreciated.

C72831
11-01-2007, 06:16 AM
I use Decimal(18,15) for storing them, since you need a high accuary (decimal places). Varchar is never a good choice for storing numbers.

Bernhard

OOT
11-01-2007, 11:09 AM
I use Decimal(18,15) for storing them, since you need a high accuary (decimal places). Varchar is never a good choice for storing numbers.

Bernhard
Thank you for that. I thought going the varchar route would be a mistake. I didn't realize that the lat/lng number would be that high. Thank you for the information ... now I'm off to edit my database :D

 
Web mp2kmag.com
mapforums.com