Solved

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

Posted on 2010-08-25
5
464 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 12

Accepted Solution

by:
mcv22 earned 500 total points
ID: 33525035
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
ID: 33525039
Can you provide the codes for the stored procedures
0
 
LVL 5

Expert Comment

by:jijeesh
ID: 33525150
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
ID: 33525275
How do you know that the document type 1 corresponds to the product A etc.?

0
 

Author Closing Comment

by:NevSoFly
ID: 33527089
Thanks to all for your help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

636 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