Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Posts
    4

    Unanswered: Executing Stored Procedure

    Hello,
    I have the following stored procedure on my sql 7.0 db:

    CREATE procedure Stuff
    (
    @tran_dateStart datetime,
    @tran_dateEnd datetime,
    @tran_Count int OUTPUT
    @tran_Sum int OUTPUT
    )

    AS

    SELECT @tran_Count = COUNT(txn_amt) FROM xfrq WHERE res_code = '000' and i_xf_date between @tran_dateStart and @tran_dateEnd

    SELECT @tran_Sum = (SELECT SUM(txn_amt) FROM xfrq WHERE res_code = '000' and i_xf_date between @tran_dateStart and @tran_dateEnd

    GO

    I run the follwing in my query anaylzer:

    EXEC Stuff

    And I get the following error message:

    Server: Msg 201, Level 16, State 4, Line 0
    Procedure stuff expects parameter '@tran_Sum' which was not supplied.

    Help!

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    You need to provide the values for the input variables and variables for the output parameters to get the value from proc.

    eg
    Code:
    declare @tran_Count int,@tran_Sum int
    exec Stuff '20030101','20031201',@tran_Count,@tran_Sum
    select @tran_Count,@tran_Sum
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Nov 2003
    Posts
    94
    Originally posted by Enigma
    You need to provide the values for the input variables and variables for the output parameters to get the value from proc.

    eg
    Code:
    declare @tran_Count int,@tran_Sum int
    exec Stuff '20030101','20031201',@tran_Count,@tran_Sum
    select @tran_Count,@tran_Sum
    ...wil give the result NULL & NULL

    exec Stuff '20030101','20031201',@tran_Count OUTPUT,@tran_Sum OUPUT

  4. #4
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    My Bad !!!
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  5. #5
    Join Date
    Dec 2003
    Posts
    4
    Originally posted by HanafiH
    ...wil give the result NULL & NULL

    exec Stuff '20030101','20031201',@tran_Count OUTPUT,@tran_Sum OUPUT
    I run the following:
    DECLARE @tran_count int,@tran_Sum int

    EXEC Stuff '10/10/2003 00:00:00 AM','10/19/2003 23:59:59 PM',@tran_Count OUTPUT,@tran_Sum OUTPUT

    I get the following error message:
    Too many arguments were supplied for procedure stuff


    Help!

  6. #6
    Join Date
    Nov 2003
    Posts
    94
    Originally posted by sisi
    I run the following:
    DECLARE @tran_count int,@tran_Sum int

    EXEC Stuff '10/10/2003 00:00:00 AM','10/19/2003 23:59:59 PM',@tran_Count OUTPUT,@tran_Sum OUTPUT

    I get the following error message:
    Too many arguments were supplied for procedure stuff


    Help!
    CREATE procedure Stuff
    (
    @tran_dateStart datetime,
    @tran_dateEnd datetime,
    @tran_Count int OUTPUT <-- missing comma
    @tran_Sum int OUTPUT
    )

  7. #7
    Join Date
    Dec 2003
    Posts
    4

    Thumbs up

    Great! It works! thanks guys

Posting Permissions

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