Limiting Rows

The number of rows affected by a query can be controled by setting rowcount. Once this is set to a value, it will remain in effect until it is set to another value or cleared by setting it to zero.

To retrieve only the first 10 rows of a table.

set rowcount 10
select * from table

To delete up to a maximum of 10 rows from a table.

set rowcount 10
delete from table

To set the rows affected to unlimited. (The normal behavour).

set rowcount 0