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?

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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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?
anushahannaAuthor Commented:
it is using sp_msforeachtable
SharathData EngineerCommented:
post your query.
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

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)
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
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..
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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

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
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.