在SQL数据库中存储纬度和经度数据时要使用什么数据类型? [英] What datatype to use when storing latitude and longitude data in SQL databases?

查看:1568
本文介绍了在SQL数据库中存储纬度和经度数据时要使用什么数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在符合ANSI SQL的数据库中存储纬度或经度数据时,什么数据类型最适合?应该使用 float 还是 decimal ,或者...?

When storing latitude or longitude data in an ANSI SQL compliant database, what datatype would be most appropriate? Should float be used, or decimal, or ...?

我知道Oracle,MySql和SQL Server添加了一些专门用于处理地理数据的特殊数据类型,但我对如何将信息存储在普通的SQL数据库感兴趣。 p>

I'm aware that Oracle, MySql, and SQL Server have added some special datatypes specifically for handling geo data, but I'm interested in how you would store the information in a "plain vanilla" SQL database.

推荐答案

十进制(9,6)

如果你不习惯precision和scale参数,这里有一个格式化字符串visual:

If you're not used to precision and scale parameters, here's a format string visual:

###。 ######

这篇关于在SQL数据库中存储纬度和经度数据时要使用什么数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆