T-SQL Recommended Practices
06 Nov 2010
SQL
The following recommended practices should help you work with T-SQL, effectively and efficiently.
- Use alias column names or string literals to improve the readability of result sets
- Avoid the use of SELECT * FROM in your queries to improve the performance
- Use the WHERE clause to restrict the rows that are returned to the dataset
- Design a strategy that helps you to work with NULL data
- Minimize the use of the OR, IN, and NOT operator because it can slow down performance
- Minimize the use of leading wildcard character operators in string comparisons because it can slow down performance
- Try to avoid the use of negative search conditions such as <>. They can slow down data retrieval because all rows in a table are evaluated
- The NOT LIKE operator can also be used to exclude string comparison conditions from the result set. Try to avoid using leading wildcards because they can slow down the retrieval of information
- Query positively! Using the OR and NOT logical operators progressively increase the rows that are returned. This can hinder the performance of SQL Server when applied to large amounts of data. Try to make use of the AND operator because this progressively reduces the rows that are returned by SQL Server
Copyright © 2025 carlbelle.com