Friday, May 01, 2009

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

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.

If you happen to get this error message in your SQL Server 2005 then read on:

In "Results to Grid" format one cannot display more than 100 resultset.  So just change the result format to either "Result to Text" or "Result to File" option

Example to reproduce this error:

Step 1: Ctrl + D (setting to Grid format for demo purpose)
Step 2: Try to print the current datetime for 101 times for example

Select GetDate()
Go 101

You would see the error as we are trying to display more than 100 resultset in a "Result to Grid" format.

Just in case you thought 100 is the limitation of GO command in SQL Server try the below script

Create table tblQuestion4
(
Sno int identity,
Fname varchar(20)
)
Go

Insert into tblQuestion4 values ('Test')
Go 101

For easy reference:

1. Ctrl + T :: Result will be displayed in Text mode
2. Ctrl + D :: Result will be displayed in Grid mode
3. Ctrl + Shift + F :: Result will be saved to a File
 
Technorati Tags:

No comments: