0
我想創建一個存儲過程,該存儲過程返回給定經緯度和搜索半徑內的所有行。SQL Server存儲過程 - 語法錯誤
當我執行的創建代碼(下)我得到:
「附近有語法錯誤<'」
它必須是此行:
@p1.STDistance(geography::Point([LATITUDE], [LONGITUDE], 4326)) <= @searchRadius as [DistanceInKilometers]
任何想法,爲什麼?
感謝
這裏是整個存儲過程:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: slinky66
-- Create date: 2013-06-26
-- Description: Returns all meeting locations within a given lat/lng and search radius
-- =============================================
CREATE PROCEDURE [dbo].[kiwone_GetNearMeetingLocationInKilometers_SP]
-- Add the parameters for the stored procedure here
@latitude decimal(18,14),
@longtitude decimal(18,14),
@searchRadius decimal (3,2),
@p1 geography
AS
BEGIN
SET NOCOUNT ON;
-- @p1 is the point you want to calculate the distance from which is passed as parameters
-- declare @p1 geography = geography::Point(@latitude,@longtitude, 4326);
select
c.LABEL_NAME,
k.*,
@p1.STDistance(geography::Point([LATITUDE], [LONGITUDE], 4326)) <= @searchRadius as [DistanceInKilometers]
from [USR_KIW_CUS_MEETING] as k
join CUSTOMER as c
on c.MASTER_CUSTOMER_ID = k.MASTER_CUSTOMER_ID
where c.USR_MEMBERSHIP_STATUS_CODE NOT IN('CR','CSD')
END
GO
謝謝 - 哇! 2005年有沒有工作?或者我最好在代碼中這樣做? – Slinky
唯一的解決方法是升級。儘量在代碼中完成你所需要的一切,至少可以說是具有挑戰性的。升級要容易得多。 – RBarryYoung