- Spaces in the table names
- ...From [User Info]
- Spaces in field names
- Select a.[First Name]...
- Dates stored as Strings
- CommissionDate as String
- Lack of descriptive 'Alias' names
- Inner Join Contacts a with (nolock)
- Inconsistent programming styles
- Using CTE, then Temp Tables, then Table Variables
- Unnecessary code
- i.e. "Ltrim(RTrim(CustomerName))"
- Scattering Tables across Multiple Databases on a Server
- ...From Sales.dbo.Customer Inner Join Leads.dbo.Customer...Inner Join Demographics.dbo.State
- Messy Code
- Difficult to follow, not spaced for easy reading
- Using Cursors
- Use Looping or Joins more efficiently
- No Comments / Documentation
- Please add comments to inform next person what you are doing
Top 10 Bad Practices When Writing #SQL
What are some bad practices I see when viewing SQL code.