注册 登录
编程论坛 SQL Server论坛

新手求助,存储过程,“错误 156 :在关键字‘ end ’附近有语法错误”

踩不扁小强 发布于 2014-10-08 16:12, 1656 次点击
create procedure proc_calculate_taxes
(
 @FromDate datetime,
 @ToDate datetime,
 @XzqId int,
 @StaticCol int,
 @StaticWay int,
 @Result varchar(255) output
)
as
   begin
            select @Result=sum(TB1.ZDBCZE) from TB1,TB2
            where (TB1.CreateTime < @ToDate and TB1.CreateTime >= @FromDate)
                and TB1.XmjlId = TB2.ID
                and
                 (TB2.XzqId IN
                 (SELECT ID
                   FROM TB3
                   WHERE
                   (TB3.Path LIKE '%,'+@XzqId+',%'))
    end
2 回复
#2
mxbing19842014-10-09 08:26
create procedure proc_calculate_taxes
(
@FromDate datetime,
@ToDate datetime,
@XzqId int,
@StaticCol int,
@StaticWay int,
@Result varchar(255) output
)
as
   begin
            select @Result=sum(TB1.ZDBCZE) from TB1,TB2
            where TB1.CreateTime < @ToDate and TB1.CreateTime >= @FromDate
                and TB1.XmjlId = TB2.ID
                and
                 TB2.XzqId IN
                 (SELECT ID
                   FROM TB3
                   WHERE
                    TB3.Path LIKE '%,'+@XzqId+',%')
    end
#3
踩不扁小强2014-10-09 10:07
回复 2 楼 mxbing1984
原来是漏了个括号,我太粗心了,谢了啊。
1