我认为这可能取决于存储纬度和经度的列类型,我认为它们可能是浮点数。您可以尝试将它们更改为 decima(x,y),如果您真的需要,甚至可以更改为字符串。
请看下面我的例子:
DECLARE @X FLOAT = 142.59289600001
DECLARE @Y FLOAT = -38.3858009900001
DECLARE @X2 DECIMAL(28,18) = 142.59289600001
DECLARE @Y2 DECIMAL(28,18)= -38.3858009900001
SELECT
a.Geog.STAsText() AS WKT
, b.Geog.STAsText() AS WKT_2
, c.Geog.STAsText() AS WKT_3
FROM
(
SELECT
GEOGRAPHY::STGeomFromText('POINT(142.59289600001 -38.3858009900001)', 4326) AS Geog
) a
,
(
SELECT
GEOGRAPHY::STGeomFromText('POINT(' + CAST(@X AS VARCHAR(25)) + ' ' + CAST(@Y AS VARCHAR(25)) + ')', 4326) AS Geog
)b
,
(
SELECT
GEOGRAPHY::STGeomFromText('POINT(' + CAST(@X2 AS VARCHAR(25)) + ' ' + CAST(@Y2 AS VARCHAR(25)) + ')', 4326) AS Geog
)c