I need assistance with a SQL Server Query

Hi Experts,
I want to create a StoredProc That takes the results of a StoredProc and then I append two columns from a table.  For example:

The original StoredProc returns a students First Name and Last Name, but I also want to display the students teacher's name which

lives in table tblTeacher.  Both the Stored Proc and tblTeacher are linked by the StudentID column.  

Can this be done?  If so, how?

Thanks in advance,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use and INSERT-EXECUTE to add the values from the first proc into a temp table

CReATE TABLE #DEMO  (add your colums)





Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
In the new procedure, I would insert the results of the stored procedure that returns the student name into a temp table or table variable.  Then you could join it to the students table based on the first and last name and then join to tblTeacher.  

That being said, why do you want to call the other stored procedure?  It seems like you could do this in a single query without jumping through all of these hoops.  


QlemoBatchelor, Developer and EE Topic AdvisorCommented:
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
2 experts spent time and effort to suggest solutions.  Why don't we get any credit?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.