473,396 Members | 2,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

multiple result sets

Hi!

Another silly question:

If a stored procedure returns multiple result sets, how do I choose the one
I want to insert into a table?

For example sp_spaceused returns two result sets if object name is ommited.
I only need the first result set. How do I do that?

Tnx!

Darko
Jul 20 '05 #1
2 3593
Hi

Each of the result sets has to be compatible with the columns in the table
that are being inserted into. You can not choose one or the other unless the
stored procedure itself has a flag that can be passed.

A workaround for sp_spaceused could be:
http://tinyurl.com/29uhp

or using the unsupported sp_msforeachtable

insert into myspace exec sp_msforeachtable "exec sp_spaceused '?'"

This may also be useful:
http://www.aspfaq.com/show.asp?id=2428

John

"Darko Jovisic" <dj******@fesb.hr> wrote in message
news:c9**********@bagan.srce.hr...
Hi!

Another silly question:

If a stored procedure returns multiple result sets, how do I choose the one I want to insert into a table?

For example sp_spaceused returns two result sets if object name is ommited. I only need the first result set. How do I do that?

Tnx!

Darko

Jul 20 '05 #2
I solved the problem. I took sp_spaceused from master and edited. I just
commented the part where it returns the second result set and saved it in my
database.

"John Bell" <jb************@hotmail.com> wrote in message
news:LB*********************@news-text.cableinet.net...
Hi

Each of the result sets has to be compatible with the columns in the table
that are being inserted into. You can not choose one or the other unless the stored procedure itself has a flag that can be passed.

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: randy.p.ho | last post by:
Using JDBC, is there a way to call a stored procedure with multiple return values? Thanks.
3
by: wxbuff | last post by:
I have a report based on our product names that consists of two parts. Both insert data into a temporary table. 1. A single grouped set of results based on all products 2. Multiple tables based...
5
by: Stanley Sinclair | last post by:
I have a need to return multiple result sets from a stored procedure. Want that SP to call others to get the data. Win2003, db2 8.1.5. Can't figure out how to handle open cursors, and return...
1
by: randall g | last post by:
I have a stored procedure which returns multiple result sets, enclosing each in its own tag. This works in ADO but not ADO.NET, where an error is returned by ExecuteXmlReader: "Invalid command...
15
by: AussieRules | last post by:
Hi, I have a need to do two selects against to stored proc's in my SQL db. At the moment, each SP is called and two different dataset are populate. Thats two round trips to the SQL server. ...
2
by: situ | last post by:
look at the procedure below CREATE PROCEDURE PR_2 ( ) dynamic result sets 1 BEGIN declare cursor_1 cursor with return to caller for select *from elements; open cursor_1; END
4
by: Liz | last post by:
Anyone have any info on how you can fill a DataSet with mutiple result sets from a SQL batch ? I know with a dataReader you can use the nextResult method but I'm lost on how you do this with a...
3
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I am wondering if someone could provide a code sample (or just a suggested approach) on how to fill a single DataGridView with multiple result sets. For example, this statement returns a one-line...
0
by: anilkodali | last post by:
How to compare multiple result sets with a set of values? Here is the scenario.. My query returns me multiple results(one column of data) and I want compare all the data at once with a set of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.