Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6943935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:13:14+00:00 2026-05-27T13:13:14+00:00

I have a large stored procedure that returns a record for a person, there

  • 0

I have a large stored procedure that returns a record for a person, there are four fields that I need to return very specific values for. I have another stored procedure that performs this specific action.

The small stored procedure is as follows:

SELECT   TOP 1
    wea.field,
    wea.degree,
    wea.degreeyear,
    wpp.ProgramCategory
FROM dbo.webeventaffiliation wea
LEFT JOIN dbo.WebProgramParticipants wpp
    ON 
        wea.userid = wpp.UserID AND
        wea.eventid = wpp.eventid
INNER JOIN dbo.WebProgramCategoryDescriptions wpcd
    ON 
        wpcd.ProgramCategory = wpp.ProgramCategory
WHERE wea.UserID = @UserID
    ORDER BY wea.datelastmodified DESC

LARGE STORED PROCEDURE SAMPLE RETURN DATA:

Name: XXXXX
Address: XXXXX
Field: [small stored procedure value]
Degree: [small stored procedure value] 
DegreeYear: [small stored procedure value]
ProgramCategory: [small stored procedure value]

My question is how do I get the 4 data items from this stored procedure into their respective columns within the dataset that is returned from the large stored procedure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:13:15+00:00Added an answer on May 27, 2026 at 1:13 pm

    Since you’re getting only one row with four values you could use OUTPUT parameters:

    EXECUTE SomeSmallerProcedure
        @field OUTPUT, @degree OUTPUT, @degreeyear OUTPUT, @ProgramCategory OUTPUT;
    

    Your procedure listed above would change to:

    ALTER PROCEDURE SomeSmallerProcedure
      @field varchar(255) OUTPUT,
      @degree varchar(255) OUTPUT,
      @degreeyear varchar(255) OUTPUT,
      @ProgramCategory varchar(255) OUTPUT
    AS BEGIN SET NOCOUNT ON;
      SELECT TOP 1
        @field = wea.field,
        @degree = wea.degree,
        @degreeyear = wea.degreeyear,
        @ProgramCategory = wpp.ProgramCategory
      -- ... rest as before
    

    The signature of your procedure above would have to include those parameters explicitly for OUTPUT.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large SELECT stored procedure that has multiple return columns and
I have a legacy stored procedure that returns a large resultset. The problem is
I have a stored procedure that is updating a very large table (with over
I have a large auditing stored procedure that prints values and runs some SELECT
I have a stored procedure that is working with a large amount of data.
I have a large CSV file and I want to execute a stored procedure
On my SQL Server 2008 I have a stored procedure with a large number
I have a stored proc that processes a large amount of data (about 5m
I have a stored procedure that goes something like this (pseudo code) storedprocedure param1,
Let's say I have a stored procedure that will do complicated logic when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.