T-SQL Anti-Patterns Overview
T-SQL Anti-Patterns Overview
Using SELECT *
Using SELECT *
SELECT *
in production code. Instead, explicitly list the columns you need. This improves performance by reducing I/O and network traffic, prevents issues when table schemas change, and makes your code more maintainable by clearly showing which columns are being used.Not Using Parameterized Queries
Not Using Parameterized Queries
Using NOLOCK Hint Inappropriately
Using NOLOCK Hint Inappropriately
Using Cursors Instead of Set-Based Operations
Using Cursors Instead of Set-Based Operations
Using Table Variables When Temporary Tables Would Be Better
Using Table Variables When Temporary Tables Would Be Better
Using Dynamic SQL Unnecessarily
Using Dynamic SQL Unnecessarily
Not Using SET-based UPDATE and DELETE
Not Using SET-based UPDATE and DELETE
Using Functions in WHERE Clauses
Using Functions in WHERE Clauses
Not Using Schema Names
Not Using Schema Names
Using GUID as Clustered Index Key
Using GUID as Clustered Index Key
Not Using Appropriate Data Types
Not Using Appropriate Data Types
Using DISTINCT Unnecessarily
Using DISTINCT Unnecessarily
Not Using Common Table Expressions (CTEs)
Not Using Common Table Expressions (CTEs)
Using COUNT(*) to Check Existence
Using COUNT(*) to Check Existence
Using Inefficient Paging Methods
Using Inefficient Paging Methods
Not Using Appropriate Constraints
Not Using Appropriate Constraints
Using Implicit Conversions
Using Implicit Conversions
Not Using Appropriate Indexing Strategy
Not Using Appropriate Indexing Strategy
Using MERGE Without Caution
Using MERGE Without Caution
Not Using SET NOCOUNT ON in Stored Procedures
Not Using SET NOCOUNT ON in Stored Procedures
Using LIKE with Leading Wildcards
Using LIKE with Leading Wildcards