sql语句中的语法不正确

时间:2014-07-21 10:46:26

标签: sql sql-server sql-server-2008

我确信这很简单,在最后30分钟盯着它之后,我仍然无法看到我做错了什么。

ALTER PROCEDURE [dbo].[spR_GetDetails]
    @UserEmail varchar(300),
    @SentName varchar(300),
    @SentEmail varchar(300),
    @UserId int OUTPUT,
    @UserName varchar(300) OUTPUT,
    @SentId int OUTPUT
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

        DELCARE @Checker int
    SET @Checker = (SELECT COUNT(UserId) AS Checker FROM AccountReps WHERE UserEmail = @UserEmail)

    IF  @Checker > 0 
    BEGIN

    END
    ELSE 

    END
END

有问题的三条线是

        DELCARE @Checker int
    SET @Checker = (SELECT COUNT(UserId) AS Checker FROM AccountReps WHERE UserEmail = @UserEmail)

    IF  @Checker > 0 

自添加这些内容后,我收到错误"错误的语法在' DELCARE'附近。"

感谢

1 个答案:

答案 0 :(得分:2)

你的DECLARE错了。

您必须使用DECLARE而不是DELCARE。