all groups > sql server (alternate) > may 2004 >
You're in the

sql server (alternate)

group:

multiple result sets


multiple result sets Darko Jovisic
5/28/2004 11:53:13 AM
sql server (alternate):
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

Re: multiple result sets John Bell
5/28/2004 2:00:11 PM
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

[quoted text, click to view]

Re: multiple result sets Darko Jovisic
5/28/2004 4:31:35 PM
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.

[quoted text, click to view]

AddThis Social Bookmark Button