@FCancellation 是作废标识,值为Y时为作废
@fmrpclosed  是行关闭标识,值为Y时为关闭
@FAuxQty为订单数量
@fcommitqty为关联数量目的:当单据作废,或,行业务关闭且@FAuxQty-@fcommitqty>0时,不执行下面BEGIN语句,其它的执行BEGIN语句,应怎么写以下这么写不行的,错在哪里
IF  @FCancellation <> 'y' or  (@fmrpclosed='y' and @FAuxQty-@fcommitqty='0')   
                            
        Begin
                         
            Set @ZYQty = @FAuxQty - @FStockQty
             .......

解决方案 »

  1.   

    有一个变通的方法IF  @FCancellation = 'y' or  (@fmrpclosed='y' and @FAuxQty-@fcommitqty>0)  
            return .......
    esle                     
            Begin 
                            
                Set @ZYQty = @FAuxQty - @FStockQty 
                .......
      

  2.   

    IF  @FCancellation <> 'y' and  (@fmrpclosed<>'y' or @FAuxQty-@fcommitqty<='0')  Begin ...
      

  3.   

    IF  not(@FCancellation <> 'y' or  (@fmrpclosed='y' and @FAuxQty-@fcommitqty='0'))  
                                
            Begin 
                            
                Set @ZYQty = @FAuxQty - @FStockQty 
                .......
    這樣試試.
      

  4.   


    根据你的需要写,如果你不需要返回也是为空
    或者这样IF  @FCancellation = 'y' or  (@fmrpclosed='y' and @FAuxQty-@fcommitqty>0)  
            print ' '
    esle                    
            Begin 
                            
                Set @ZYQty = @FAuxQty - @FStockQty 
                ....... 
      

  5.   


    IF NOT 里面是除了NOT里面这一部份吗,修改后符合(@fmrpclosed='y' and @FAuxQty-@fcommitqty>'0'这一部份还是会执行BEGIN下面的语句,还要怎么修改法呢
      

  6.   

    那就用下面的
    IF  not(@FCancellation <> 'y' and  (@fmrpclosed='y' and @FAuxQty-@fcommitqty='0'))  
                                
            Begin 
                            
                Set @ZYQty = @FAuxQty - @FStockQty 
                ....... 
    我這個思路是排除法.