Title

Kodyaz Development Resources

Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Vista, etc.
Welcome to Kodyaz Development Resources Sign in | Join | Help

The query has exceeded the maximum number of result sets

By chance recently I got the following message from the SQL Server 2005 query editor window after I ran a 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 )
 

You can even customize the shortcut keys in SQL Server Management Studio to make your 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. 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.

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



Copyright © 2004 - 2008 Eralper Yilmaz. All rights reserved.
Powered by Community Server, by Telligent Systems