28

我正在寻找以下 mySQL 语句的 MSSQL 等效项:

SELECT Y(location) as Lat, X(location) as Lon from myTable;

我想获取存储为地理数据类型的地理的 X 和 Y 值。

我知道STAsText(Location) as Location会给我 WKT...我只需要 X 和 Y 数值。

4

1 回答 1

57

对于地理:

SELECT location.Lat as Lat, location.Long as Lon from myTable;

对于几何:

SELECT location.STY as Lat, location.STX as Lon from myTable;
于 2012-06-01T19:12:16.303 回答