Incorrect SQL procedure lin_WriteCastleTax

Issue #11 new
Volodymyr Melnychenko created an issue

В паке от смели процедура принимает всего 2 параметра, а в с1 china 5.

packet036_RequestWriteCastleTax

CREATE PROCEDURE [DBO].[lin_WriteCastleTax]      
(      
 @nIsCastle int,    
 @tax_type int,      
 @tax_rate  int,      
 @to_change  int,      
 @residence_id  int      
)      
AS      
SET NOCOUNT ON      

IF(@nIsCastle = 1)    
BEGIN    
 IF (@tax_type = 2)    
  UPDATE castle SET tax_child_rate = @tax_rate, tax_child_rate_to_change = @to_change  WHERE id = @residence_id      
 ELSE IF (@tax_type = 1)    
  UPDATE castle SET tax_rate = @tax_rate, tax_rate_to_change = @to_change  WHERE id = @residence_id      
 ELSE    
  RAISERROR ('tax type is invalid. castle cannot save type[%d] id and castle id[%d].', 16, 1, @tax_type, @residence_id )    
END    
ELSE IF(@nIsCastle = 0)    
BEGIN    
 IF (@tax_type = 2)    
BEGIN  
  UPDATE agit SET tax_child_rate = @tax_rate, tax_child_rate_to_change = @to_change  WHERE id = @residence_id      
END  
 ELSE IF (@tax_type = 1)    
  UPDATE agit SET tax_rate = @tax_rate, tax_rate_to_change = @to_change WHERE id = @residence_id      
 ELSE    
  RAISERROR ('tax type is invalid. agit cannot save type[%d] id and agit id[%d].', 16, 1, @tax_type, @residence_id )    
END



GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

Comments (1)

  1. smeli

    в паке смели есть всё нормально:

    /********************************************      
    lin_WriteCastleTax      
    
    INPUT      
    OUTPUT      
    return      
    made by      
     carrot      
    date      
     2002-06-10      
    change carrot 2003-12-22    
     add tax_type, residence type to differentiate agit from castle    
    change carrot 2004-02-29  
     add TaxRateToChange  
    ********************************************/      
    CREATE PROCEDURE [dbo].[lin_WriteCastleTax]      
    (      
     @nIsCastle int,    
     @tax_type int,      
     @tax_rate  int,      
     @to_change  int,      
     @residence_id  int      
    )      
    AS      
    SET NOCOUNT ON      
    
    IF(@nIsCastle = 1)    
    BEGIN    
     IF (@tax_type = 2)    
      UPDATE castle SET tax_child_rate = @tax_rate, tax_child_rate_to_change = @to_change  WHERE id = @residence_id      
     ELSE IF (@tax_type = 1)    
      UPDATE castle SET tax_rate = @tax_rate, tax_rate_to_change = @to_change  WHERE id = @residence_id      
     ELSE    
      RAISERROR ('tax type is invalid. castle cannot save type[%d] id and castle id[%d].', 16, 1, @tax_type, @residence_id )    
    END    
    ELSE IF(@nIsCastle = 0)    
    BEGIN    
     IF (@tax_type = 2)    
    BEGIN  
      UPDATE agit SET tax_child_rate = @tax_rate, tax_child_rate_to_change = @to_change  WHERE id = @residence_id      
    END  
     ELSE IF (@tax_type = 1)    
      UPDATE agit SET tax_rate = @tax_rate, tax_rate_to_change = @to_change WHERE id = @residence_id      
     ELSE    
      RAISERROR ('tax type is invalid. agit cannot save type[%d] id and agit id[%d].', 16, 1, @tax_type, @residence_id )    
    END
    
    
    
    GO
    SET QUOTED_IDENTIFIER OFF 
    GO
    SET ANSI_NULLS ON 
    GO
    
    SET QUOTED_IDENTIFIER ON 
    GO
    SET ANSI_NULLS ON 
    GO
    
  2. Log in to comment