2012-03-29 111 views
3

我想我找不到我的(明顯的愚蠢)錯誤:-)。空間數據類型

在數據庫上下面的SELECT語句:

SELECT geography::STMPolyFromText('MULTIPOLYGON((((11.791039 47.5448077, 11.7910551 47.544757, 11.7911677 47.5446375, 11.7644687 47.542786))))',4326) 

和錯誤是:

NET Framework error occurred during execution of user-defined routine or aggregate "geography": 
System.FormatException: 24141: A number is expected at position 26 of the input. The input has (11.791039. 
System.FormatException: 
    at Microsoft.SqlServer.Types.WellKnownTextReader.RecognizeDouble() 
    at Microsoft.SqlServer.Types.WellKnownTextReader.ParseLineStringText() 

不容找到我的錯誤,你看到的錯誤也許有?!


就找到了解決辦法:一 '(' 太多

回答

1

我認爲你有一個太多對括號後MULTIPOLYGON ... this example shows only 3,但你必須4.

。請改爲:

SELECT geography::STMPolyFromText 
(
    'MULTIPOLYGON 
    ( 
     (
      (
       11.791039 47.5448077, 
       11.7910551 47.544757, 
       11.7911677 47.5446375, 
       11.7644687 47.542786 
      ) 
     ) 
    )',4326 
)