473,779 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3623
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_msforeachtab le

insert into myspace exec sp_msforeachtab le "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.h r...
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******** *************@n ews-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
10689
by: randy.p.ho | last post by:
Using JDBC, is there a way to call a stored procedure with multiple return values? Thanks.
3
2550
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 on individual product names. I am getting data by calling the same stored procedure multiple times... for the single set of data I use "product like '%'" To get the data for individual products, I am using a cursor to parse
5
8683
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 result sets. Thought about global temp tables.
1
2352
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 sent to ExecuteXmlReader. The command must return an Xml result." The procedure looks like this: create procedure xxx as select '<tag1>'
15
6515
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. I can combine the two SP into one, and have one SP that executes two Select Statements, and effectivly returns two result sets, and I could call this with one trip to the SQL server from my VB app.
2
3362
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
10933
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 dataAdapter .... TIA .. L
3
6237
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 result set for each table in the database: EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'" It would be handy to be able to put them all into one DataGridView. I would like to be able to handle an arbitrary SQL statement; above is just...
0
2327
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 data. For example my query returns 1,2,3 and I want compare the result set with (1,3), can I do that using a query with out using stored procedures? Obviously using the in clause isn't working(i.e., (1,2,3) in (1,3)), any other alternative. Thanks,
0
10305
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9928
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8959
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.