DF018: The SET ROWCOUNT option is deprecated.

Last modified: May 28, 2025

The topic describes the DF018 T-SQL code analysis rule.

Category

DEPRECATED

Message

The SET ROWCOUNT option is deprecated.

Description

It is not recommended to use the SET ROWCOUNT statement to restrict the number of rows. Use the TOP clause instead.

Noncompliant code example

SET ROWCOUNT 10
SELECT * FROM dbo.Customers

Compliant solution

SELECT TOP(10) * FROM dbo.Customers