有空看了google maps的相关东东,想对都市家园 www.edongguan.com 加入地图的功能,于是得考虑坐标问题,要什么类型:varchar、float、decimal……
综合考虑,以后的扩展性,用decimal,原因是精度比较高,以下为Ms sql 2008帮助中提到:
精度 | 存储字节数 |
---|---|
1 - 9 |
5 |
10-19 |
9 |
20-28 |
13 |
29-38 |
17 |
要注意在.net存储过程中,实例化时:
param[13] = new SqlParameter("@MapsLat", SqlDbType.Decimal);
param[13].Precision = 30;
param[13].Scale = 25;
param[13].Value = ui.MapsLat;
param[14] = new SqlParameter("@MapsLng", SqlDbType.Decimal);
param[14].Precision = 30;
param[14].Scale = 25;
sql 存储过程:
@MapsLat decimal(30,25),--googlemaps相关
@MapsLng decimal(30,25),