Solved

How do I combine the results of two stored procedures into one dataset?

Posted on 2010-08-25
5
459 Views
Last Modified: 2012-05-10
I have two stored procedures.  One (usp_Products) results in a distinct list of products my company sells.  The other (usp_DocType) results in a distnict list of document types we provide.  I want to combine these so that I get one dataset with both.  Example below.

Products                        DocumentTypes
A                                             1
B                                             2
C                                             3


0
Comment
Question by:NevSoFly
5 Comments
 
LVL 12

Accepted Solution

by:
mcv22 earned 500 total points
Comment Utility
CREATE TABLE #Product
(
   ID INT IDENTITY(1,1),
   Product VARCHAR(MAX)
)

CREATE TABLE #DocumentType
(
   ID INT IDENTITY(1,1),
   DocumentType INT
)

INSERT #Product (Product) EXEC usp_Products
INSERT #DocumentType (DocumentType) EXEC usp_DocType

SELECT
 p.Product AS Products,
 d.DocumentType AS DocumentTypes
FROM
 #Product p
FULL JOIN
 #Document d
ON
 p.ID = d.ID
0
 
LVL 16

Expert Comment

by:Sheils
Comment Utility
Can you provide the codes for the stored procedures
0
 
LVL 5

Expert Comment

by:jijeesh
Comment Utility
If you just call both SP in an another single SP, the result will apprear in a single data set, but in difeerent DataTables.
0
 
LVL 8

Expert Comment

by:mustaccio
Comment Utility
How do you know that the document type 1 corresponds to the product A etc.?

0
 

Author Closing Comment

by:NevSoFly
Comment Utility
Thanks to all for your help.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now