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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Sql question

  • 07-10-2008 5:48pm
    #1
    Registered Users, Registered Users 2 Posts: 6,535 ✭✭✭


    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, Registered Users 2 Posts: 7,989 ✭✭✭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, Registered Users 2 Posts: 569 ✭✭✭none


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


  • Registered Users, Registered Users 2 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