SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for ASP.Net, SQL Server, Reporting Services, T-SQL, Windows, AWS, SAP HANA and ABAP


The query has exceeded the maximum number of result sets

Query has exceeded the maximum number of result sets SQL Server error message is one of errors I got from SQL Server 2005 Query Editor window after I ran an SQL script.

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.

The message is clear and explaning the situation which causes this message to be displayed to the user who is running the sql code. It states that the sql code returns more than 100 results sets. And no more than this number, 100 result sets will be displayed in the results grid view.
I changed the results view screen to text mode by using the Ctrl + T shortcut key combination and re-run the sql code to view whether the same message will be displayed or not. But more than 100 result sets were displayed in text mode in the result pane.
This seems to be a performance issue that prevents Microsoft SQL Server Management Studio tries to keep its state in a higher performance. To get the result sets of a sql query in text mode is faster than getting the same results in grid view.
So this message is in a way stating that text mode for results is a safer mode in SQL Server 2005. I checked the SQL Query Analyzer with running the same number of result sets returning query in both text and grid view. But neither returned the maximum number of result sets has been exceeded warning message.
So we may consider this as a plus for Query Editor in SQL Server Management Studio.
You can try to see what you get when you run more than 100 of the simple select query "SELECT 1".

Here a few of the shortcut keys you can use in SQL Server Management Studio.

Ctrl + T : View results in text mode

Ctrl + D : View results in grid view

Ctrl + L : View estimated execution query plan

Ctrl + K, Ctrl + C : Comment highlighted lines of codes (the comment functionality can be used in SQL Query Analyzer with Ctrl + Shift + C )

Ctrl + K, Ctrl + U : Uncomment highlighted lines of commented code blocks (the uncomment functionality can be used in SQL Query Analyzer with Ctrl + Shift + R )

SQL Server professionals can even customize shortcut keys in SQL Server Management Studio to make their frequently used functionalities with a few key strokes. To customize the key combinations and attach stored procedures to these key combinations go to Tools in the main menu on SSMS (SQL Server Management Studio). And select Options in the sub menu items under the Tools menu. Then the below Options screen will be displayed, drill down to Environment till Keyboard. You can see that I added the Ctrl + F1 to get use of the sp_helptext stored procedure to view the inside code of procedures and functions.

define shortcut keys in SQL Server Management Studio

You can see that as default,

Alt + F1 is set for sp_help

Ctrl + 1 is set for sp_who and

Ctrl + 2 is set for sp_lock



SQL Server

SQL Server 2019 Installation
download SQL Server 2019
download SQL Server 2017
download SQL Server 2016
download SQL Server 2014
download SQL Server 2012
MacOS ve SQL Server 2019


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.