Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    126

    Unanswered: Stored Procedure Variable problem

    I have this:

    Code:
    CREATE procedure sp_ISRA_BuildTablesStep2
    
    (
    @BACKENDDATEVALUE varchar(10),
    @QUERYSTATMENT varchar(10)
    )
    
    AS
    
    DECLARE @SQL varchar(2000)
    SET @SQL = " if object_id(ISRA_BACK') is not null drop table ISRA_BACK
    
    	SELECT 	ISRA_NEW.SRC_CODE, 
    			Count(RG_BA_SHIPPED_ORDERS.ORDER_NBR) AS SUBSEQUENT_ORDERS, 
    			Sum(RG_BA_SHIPPED_ORDERS.TOTAL_AMT) AS INVOICE_TOTAL, 
    			Sum(RG_BA_SHIPPED_ORDERS.SHIP_CHARGE) AS SHIPPING_CHARGE, 
    			Sum(RG_BA_SHIPPED_ORDERS.SHIP_COST) AS SHIPPING_COST, 
    			Sum(RG_BA_SHIPPED_ORDERS.MARGIN) AS MARGIN 
    	
    	INTO 		BA_BACK
    	
    	FROM 		ISRA_NEW INNER JOIN RG_BA_SHIPPED_ORDERS ON ISRA_NEW.CUST_NBR = RG_BA_SHIPPED_ORDERS.CUST_NBR
    	
    	WHERE 	(RG_BA_SHIPPED_ORDERS.DATE > [ISRA_NEW].[MaxOFDATE]) And (RG_BA_SHIPPED_ORDERS.DATE < =" +  @BACKENDDATEVALUE + ") "+ @QUERYSTATMENT+"
    	
    	GROUP BY 	ISRA_NEW.SRC_CODE"
    
    EXEC(@SQL)
    GO
    but I get this msg when I run:

    sp_BA_BuildTablesStep2 '02/02/03','and RG_BA_SHIPPED_ORDERS.CO_TYPE =1'

    Server: Msg 137, Level 15, State 2, Line 14
    Must declare the variable '@BACKENDDATEVALUE'.

    What did I do wrong???

    Thanks,

    Ken

  2. #2
    Join Date
    Jan 2003
    Posts
    126
    never mind... I changed the wrong procedure!

    What a Friday!

    Ken

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •