472,102 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 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 3476
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
reply views Thread by leo001 | last post: by

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.