Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 467
  • Last Modified:

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

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
NevSoFly
Asked:
NevSoFly
1 Solution
 
mcv22Commented:
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
 
SheilsCommented:
Can you provide the codes for the stored procedures
0
 
jijeeshCommented:
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
 
mustaccioCommented:
How do you know that the document type 1 corresponds to the product A etc.?

0
 
NevSoFlyAuthor Commented:
Thanks to all for your help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now