郁闷了,为什么存储过程里一加入这句保存就提示错误!!高手来看看!
在一个存储过程里,如果没有下面这句,可以正常修改保存,但一加入就提示错误!
我怎么看这句语句也没有错误呀:
select f.region , f.salescentre, f.salessup, f.route, sum(e.ao_dsd_sales_uc) as dsd_uc, sum(e.ao_101in_sales_uc) as 101in_uc , sum(e.ao_101out_sales_uc) as 101out_uc into #bevsales from RouteSKUActual as e , #route_region as f where e.sku in (select sku from bevcatg_sku where bevcatg=@bevcatg) and e.route=f.route group by f.region , f.salescentre, f.salessup , f.route
注:#route_region 表已经在前面的语句建立,并且有正确的数据,
保存时提示的错误是:ERROR 170 , INCORRECT SYNTAX NEAR '101 '. INCORREST SYNTAX NEAR THE KEYWORD 'AND '
------解决方案--------------------select f.region , f.salescentre, f.salessup, f.route, sum(e.ao_dsd_sales_uc) as dsd_uc, sum(e.ao_101in_sales_uc) as 101in_uc , sum(e.ao_101out_sales_uc) as 101out_uc --into #bevsales 先查询一下能不能出结果
from RouteSKUActual as e , #route_region as f where e.sku in (select sku from bevcatg_sku where bevcatg=@bevcatg) and e.route=f.route group by f.region , f.salescentre, f.salessup , f.route
------解决方案--------------------select f.region , f.salescentre, f.salessup, f.route,
sum(e.ao_dsd_sales_uc) as dsd_uc, sum(e.[ao_101in_sales_uc]) as [101in_uc] ,
sum(e.[ao_101out_sales_uc]) as [101out_uc]
into #bevsales
from RouteSKUActual as e , #route_region as f
where e.sku in
(select sku
from bevcatg_sku
where bevcatg=@bevcatg)
and e.route=f.route
group by f.region , f.salescentre, f.salessup , f.route