Transact-SQL (T-SQL) is Microsofts proprietary extension to SQL that is used with Microsoft SQL Server and Azure SQL Database. T-SQL adds procedural programming, local variables, and various support functions to standard SQL.
T-SQL Anti-Patterns Overview
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
Using NOLOCK Hint Inappropriately
Using Cursors Instead of Set-Based Operations
Using Table Variables When Temporary Tables Would Be Better
Using Dynamic SQL Unnecessarily
Not Using SET-based UPDATE and DELETE
Using Functions in WHERE Clauses
Not Using Schema Names
Using GUID as Clustered Index Key
Not Using Appropriate Data Types
Using DISTINCT Unnecessarily
Not Using Common Table Expressions (CTEs)
Using COUNT(*) to Check Existence
Using Inefficient Paging Methods
Not Using Appropriate Constraints
Using Implicit Conversions
Not Using Appropriate Indexing Strategy
Using MERGE Without Caution
Not Using SET NOCOUNT ON in Stored Procedures
Using LIKE with Leading Wildcards