469,945 Members | 2,422 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

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 3390
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Stanley Sinclair | last post: by
1 post views Thread by randall g | last post: by
2 posts views Thread by situ | last post: by
3 posts views Thread by =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.