0

我正在尝试创建一个存储过程,该过程返回给定纬度/经度和搜索半径内的所有行。

当我执行创建代码(如下)时,我得到:

“'<' 附近的语法不正确”

它必须是这一行:

@p1.STDistance(geography::Point([LATITUDE], [LONGITUDE], 4326)) <= @searchRadius as [DistanceInKilometers]

任何想法为什么?

谢谢

这是整个 SPROC:

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
4

1 回答 1

1

和数据类型不在 SQL Server 2005 中。它们直到 SQL Server 2008 才引入GeographyGeometry

于 2013-06-26T20:34:46.523 回答