我有一個字段,其中包含定義地理圍欄(多邊形)的緯度/長度座標的字符串。每個都用逗號分隔。用TSQL替換字符串中每個第二個字符的實例
如: '緯度,經度,緯度,經度,緯度,經度'
如:148.341158,-21.500773,148.341406,-21.504989,148.375136,-21.513174,148.401674,-21.535247,148.418044,-21.532767,148.408867, -21.511685,148.414075,-21.508461,148.36968,-21.432567,148.349094,-21.438768,148.346862,-21.480187,148.341158,-21.500773,
我想與MSSQL的地理類型(http://msdn.microsoft.com/en-us/library/bb933971.aspx)
使用DECLARE @g geography;
SET @g = geography::STPolyFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326);
SELECT @g.ToString();
這似乎要求:'lat long,lat long,lat long'即:這對之間沒有逗號。
我無法更改源數據,因爲它由供應商程序使用。我需要操縱字符串來刪除每2個逗號中的每1個,否則,得到正則表達式在TSQL中工作