Skip to content

ROWCOUNT

SET ROWCOUNT 5;
SELECT *
FROM Products;
ProductID ProductName SupplierID CategoryID QuantityPerUnit UnitPrice UnitsInStock UnitsOnOrder ReorderLevel Discontinued
1 Chai 1 1 10 boxes x 20 bags 18 39 0 10 0
2 Chang 1 1 24 - 12 oz bottles 19 17 40 25 0
3 Aniseed Syrup 1 2 12 - 550 ml bottles 21 13 70 25 0
4 Chef Anton's Cajun Seasoning 2 2 48 - 6 oz jars 22 53 0 0 0
5 Chef Anton's Gumbo Mix 2 2 36 boxes 21.35 0 0 0 1

In the SQL code example, the SET ROWCOUNT 5; statement is limiting the number of rows returned by the SELECT * FROM Products; statement to 5 rows. This allows users to limit the results of their queries to a manageable number.