Learn To Restrict the Number of Rows Returned To the Query In SQL Server

Neil Pike

July 27, 1999

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. With SQL 6.5 and below use the "set rowcount " option.

e.g.SET ROWCOUNT 10 
SELECT * FROM

This option is still available with SQL 7.0, but this supports the TOP function as well which will optimise better so use this instead. Note that the database concerned MUST be in SQL 7.0 compatibility mode - run sp_dbcmptlevel to check whether it is or not.

e.g. select TOP(10) from  

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like