当使用master时,STPolyFromText函数在时钟和反时钟顺序上工作正常,但在使用myDB时不能在反时钟模式下工作。这是我的代码:
use MyDB
go
DECLARE @polygon geography
DECLARE @clock_wise nvarchar(500)='POLYGON((35.2515 46.9657,35.2874 46.9784,35.3162 46.9466,35.3431 46.9817,35.3506 47.0122,35.3166 47.0324,35.3367 47.0541,35.3256 47.0768,35.3004 47.0673,35.2969 47.0479,35.2747 47.0527,35.2516 47.0521,35.2506 47.0146,35.2515 46.9657))'
DECLARE @anti_clock_wise nvarchar(500)='POLYGON((35.708 51.7622,35.6211 51.1277,35.4761 51.3704,35.7952 51.2544,35.5078 51.4838,35.5559 51.6161,35.7448 51.4571,35.8509 51.6945,35.8362 51.3961,35.708 51.7622))'
SET @polygon = geography::STPolyFromText(@anti_clock_wise,4326)
select @polygon
答案 0 :(得分:1)
将兼容模式从SQL Server 2008(100)更改为SQL Server 2012(110)。