Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Sql question

Options
  • 07-10-2008 6:48pm
    #1
    Registered Users Posts: 6,521 ✭✭✭


    alter proc LIBARY_no_of_overdue

    @student_id int,
    @overdue int,
    @output int

    as

    select @overdue=count(*)
    from loan_table
    inner join book_table on
    loan_table.book_id =book_table.book_isbn
    inner join rule_table on
    book_table.rule_id=rule_table.rule_id
    where loan_table.student_id=@student_id
    and datediff(day, date_loaned,GETDATE())<rule_limit

    thats my code and when i parse and execute it, it does so sound. But when i highligh the procs name and execute I get this error message.

    Msg 201, Level 16, State 4, Procedure LIBARY_no_of_overdue, Line 0
    Procedure or Function 'LIBARY_no_of_overdue' expects parameter '@student_id', which was not supplied.

    Im not sure whats wrong with it...any ideas?


Comments

  • Registered Users Posts: 7,680 ✭✭✭Trampas


    joe123 wrote: »
    alter proc LIBARY_no_of_overdue

    @student_id int,
    @overdue int,
    @output int

    as

    select @overdue=count(*)
    from loan_table
    inner join book_table on
    loan_table.book_id =book_table.book_isbn
    inner join rule_table on
    book_table.rule_id=rule_table.rule_id
    where loan_table.student_id=@student_id
    and datediff(day, date_loaned,GETDATE())<rule_limit

    thats my code and when i parse and execute it, it does so sound. But when i highligh the procs name and execute I get this error message.

    Msg 201, Level 16, State 4, Procedure LIBARY_no_of_overdue, Line 0
    Procedure or Function 'LIBARY_no_of_overdue' expects parameter '@student_id', which was not supplied.

    Im not sure whats wrong with it...any ideas?

    expects parameter '@student_id', which was not supplied.

    basically looking for a value for student id


  • Registered Users Posts: 569 ✭✭✭none


    I suppose these (@student_id int, @overdue int, @output int) are parameters and must be provided at runtime.


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    test it using

    EXEC LIBARY_no_of_overdue 000000, 1, 1

    Thats just an example

    You need to pass your 3 params to to it. If you are using MSSQL, there is an execute function builtin to the management studio which you can use.


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    There are three parameters which will have to be passed to the stored procedure from the calling program.

    You have to call the sp with spName 1,1,1 or something similar.


Advertisement