Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.


[Home] [Table of Contents] [Previous Section] [Next Section]

Breck Carter
Last modified: February 12, 1998
mail to: bcarter@bcarter.com


Tip 77: Sybase SQL Anywhere
Performance Tips & Techniques


33 - Limit Result Sets With SET ROWCOUNT

SQL Server compatibility has brought many Transact SQL features to SQL Anywhere. One of these is the SET ROWCOUNT <maximum-row-count> statement. According to the documentation this limits the number of rows fetched for any cursor. It also affects the number of rows returned by the DataWindow Retrieve() function in PowerBuilder as shown in Figure 33A.

Figure 33A - SET ROWCOUNT Works With PowerBuilder Retrieve()

Figure 33B shows the script behind the "<< SET ROWCOUNT nnn" button in Figure 33A. This kind of logic is handy for testing new code and for the prevention of runaway adhoc queries. The limit can be removed by executing a SET ROWCOUNT 0 statement.

Figure 33B - SET ROWCOUNT In PowerScript

string ls_SQL

ls_SQL = "SET ROWCOUNT " + parent.sle_rowcount.text

EXECUTE IMMEDIATE :ls_SQL USING SQLCA;

IF SQLCA.SQLCode <> 0 THEN

MessageBox ( "Error", "SET ROWCOUNT failed" )

RETURN

END IF


[Home] [Table of Contents] [Previous Section] [Next Section]