maximum number of result sets

When I run a query, I get the following error: is this a setting that can be overcome in SSMS 2005?

thanks
The query has exceeded the maximum number of result sets that can be displayed in the results grid. Only the first 100 result sets are displayed in the grid.

Open in new window

LVL 6
anushahannaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
do you have a loop in your code?
0
anushahannaAuthor Commented:
it is using sp_msforeachtable
0
SharathData EngineerCommented:
post your query.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
>it is using sp_msforeachtable
that means, 1 resultset per table to be returned.

what are you doing to need such a thing for so many tables?

apart from that: change the output to text, this will overcome the problem (though you won't like the outcome)

otherwise, ensure the script inside of sp_msforeachtable uses a SET NOCOUNT ON, and eventually does not return a resultset for tables to be skipped (or the like)
0
halfbloodprinceCommented:
In SSMS open a new query window with a default context of Master and Select "Results in Text" within the Query Menu:  (Query => Results To => "Results to Text")  

And then run your query
0
anushahannaAuthor Commented:
the query is

sp_MSforeachtable 'sp_spaceused ''?'''

it takes 6 seconds to give this error (the status bar says 100 rows- that is why i was wondering if that is a setting somewhere).

as halfbloodprince said, i make it "Results to Text", and all the 234 records show up in text format.

I put "SET NOCOUNT ON" before the query, and still is the same issue..
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>sp_spaceused
will return 1 recordset per table, not 1 resultset with 234 records...

so, this should work


create table tmp_spaceused ( name sysname, rows int, reserved varchar(20), data varchar(20), index_size varchar(20), unused varchar(20))
exec sp_MSforeachtable 'insert into tmp_spaceused  exec sp_spaceused ''?'' '
select * from tmp_spaceused
drop table tmp_spaceused

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anushahannaAuthor Commented:
excellent! Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.