空間クエリ(SQL Server 2016)からパラメータ化ストアドプロシージャを作成しようとしています。基本的な空間クエリは、パラメータ(@long
/経度)がハードコーディングされている場合(174.7115など)に問題ありません。空間クエリ:ユーザー定義ルーチンまたは集計 "地理"の実行中に.NET Frameworkエラーが発生しました。
経度(@long
)のパラメータを使用してStored Procを作成しようとすると、次のエラーが発生します。
ここでは6522、レベル16、状態1、プロシージャSpatial8、ライン5 [バッチスタートライン0] A .NET Frameworkのエラーは、ユーザー定義のルーチンまたは集計 "地理" の実行中に発生しました: システム.FormatException:24141:数字は入力の11桁目に表示されます。入力は@Longです。 にSystem.FormatException:Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType型) でMicrosoft.SqlServer.Types.WellKnownTextReader.RecognizeDouble()Microsoft.SqlServer.Types.WellKnownTextReader.ParsePointText(ブールparseParentheses)で ででMicrosoft.SqlServer.Types.SqlGeography.GeographyFromTextでMicrosoft.SqlServer.Types.SqlGeography.ParseText(OpenGisType型、SqlChars taggedText、のInt32 SRID) でMicrosoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisTypeタイプ、のInt32 SRID) (OpenGisType型、SqlChars taggedText、Int32 srid) .........................
は、ストアドプロシージャ..です
CREATE PROC Spatial8 @Long decimal(9,6)
AS
DECLARE @Car geography;
SET @Car = geography::STGeomFromText ('Point(@Long -36.81143)', 4326);
/* Add 20m buffer to each side of the cars position (Lat and long) */
DECLARE @Pointbuffer geography;
SET @Pointbuffer = @Car.STBuffer ('20');
Select *, @Pointbuffer.STContains(geography ::Point(Latitude, Longitude, 4326)) As PointBuffer
From dbo.Location
WHERE @Pointbuffer.STContains(geography ::Point(Latitude, Longitude, 4326)) = 1
何かアドバイス、提案、または回避策をいただければ幸いです。 Geography to Geometryを交換しようとしましたが、同じエラーが発生します。