×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Stored Procedure use result of another Stored Procedure

Stored Procedure use result of another Stored Procedure

Stored Procedure use result of another Stored Procedure

(OP)
I have a stored procedure that looks up a record in a lookup table to find the last student id used, adds 1 to it, saves the record into this lookup table, then a new record is added to another table using this new student id.

This works fine, however I have another stored procedure to lookup values in a table to use as defaults, these are set by the user and can be different depending on which year the user chooses, hence why I cannot have the defaults set within the table.

When this stored procedure is ran it shows results as an access crosstab query would, there will only ever be one row in the result, question... how can I use the result of this stored procedure to update the student record I have just added to the table?

Thanks in anticipation...

RE: Stored Procedure use result of another Stored Procedure

(OP)
I have found a way around this by converting the stored procedure that was picking up the default values to a view, then inserting the record into the table using a select from the view.

All works fine.

RE: Stored Procedure use result of another Stored Procedure

I try to stay away from views. They're run locally, return an entire recordset,and aren't compliled.

I don't think you can:

Select * from sp_yourproc.

However, I have had success with creating a function and inner joining to it.

I.E:

Select * from tblYourTabel
Inner Join on
fn_SomeFunction.ID = tblYourTbl.ID


RE: Stored Procedure use result of another Stored Procedure

(OP)
Thanks,

Not too fussed in this instance about the whole recordset being returned as it will only ever select all records from the table.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close