DF035: The DELETE statement is used without the limiting clauses.
Last modified: December 25, 2024
The topic describes the DF035 T-SQL code analysis rule.
Category
BEST PRACTICE
Message
The DELETE statement is used without the limiting clauses.
Description
The DELETE statement without the row limiting conditions (WHERE or JOIN clauses) may lead to unexpected data loss.
Additional information
Without these conditions, the DELETE statement removes all rows from the specified table, which can result in the deletion of important data. It’s important to include appropriate conditions in the DELETE statement to ensure that only the intended rows are deleted. This helps prevent accidental data loss and maintains data integrity within the database.
Noncompliant code example
DELETE FROM dbo.Employee;
Compliant solution
DELETE FROM dbo.Employee WHERE EmployeeId = 12;
Was this page helpful?