SQL: Best data type for lat & long coordinates? Float vs Decimal?

Im importing a new zip code table into SQL and was curious if there is a best way to store the lat and long?  I was inclined to store as decimal with 10 precision  (i.e. 43.901848      -101.246893)
arthurh88Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dr. KlahnPrincipal Software EngineerCommented:
Well, no matter how it's stored, part of it must be stored as floating.

In degrees-minutes-seconds (DMS) format, hours and minutes can be integer, but seconds must be floating point.  Storage = 2*I + 1*FP

In decimal format, one floating point will do.  Storage = 1*FP

So storing in DMS format will take more storage than storing in floating point.  And doing "nearness" calculations is easier in decimal floating point.  If you don't see a need (or only an infrequent need) to display in DMS format, then decimal is the way to go.
0
arthurh88Author Commented:
Hi Dr. Klahn.  Do I need to do anything particular in my SQL table design other than "decimal(10, 7)" ?  I'm not sure how I specify 1*FP for that decimal field.
0
Dr. KlahnPrincipal Software EngineerCommented:
Sorry to say that I'm not an expert in SQL.  I weighed in on this question strictly from a data structures viewpoint.  But I'm sure if you leave the question up, someone will be able to help you with that issue.
0
Nitin SontakkeDeveloperCommented:
Starting SQL Server 2012 spatial data types are now available within database. However they are implemented as in .NET CLR.

Details are here.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arthurh88Author Commented:
that helps!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.