By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,919 Members | 1,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,919 IT Pros & Developers. It's quick & easy.

multiple result sets

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.