日期:2014-05-17  浏览次数:20473 次

求助:'=' 附近有语法错误。
在查询分析器中
UPDATE tabWarehouseStock  Set MontFinallyStock = MontFinallyStock-2,
                              Fsum = fsum-1600,
                              BeginPrice=CASE(FSUM=0 THEN 0 ELSE (fsum -1600)/
                              (MontFinallyStock-2) END)
WHERE WAREHOUSENO='W003'
AND Fnumber='20103508'
运行时提示"第 3 行: '=' 附近有语法错误。" 
求助各位,在此先谢谢各位了

------解决方案--------------------
UPDATE  tabWarehouseStock
SET     MontFinallyStock = MontFinallyStock - 2 ,
        Fsum = fsum - 1600 ,
        BeginPrice = ( CASE WHEN FSUM = 0 THEN 0
                            ELSE ( ( fsum - 1600 ) / ( MontFinallyStock - 2 ) )
                       END )
WHERE   WAREHOUSENO = 'W003'
        AND Fnumber = '20103508'

------解决方案--------------------
少了个when
UPDATE tabWarehouseStock  Set MontFinallyStock = MontFinallyStock-2,
                              Fsum = fsum-1600,
                              BeginPrice=(CASE when FSUM=0 THEN 0 ELSE (fsum -1600)/
                              (MontFinallyStock-2) END)
WHERE WAREHOUSENO='W003'
AND Fnumber='20103508'
------解决方案--------------------
case fsum when 0 then 0 when 1600 then 0 else ((fsum - 1600)/( MontFinallyStock-2)) end