Tag Archives: Common SQL Server Mistakes

Common SQL Server Mistakes – Functions in the WHERE Clause

This continues my series on Common SQL Server mistakes, looking at more T-SQL mistakes. What’s Wrong? If you saw a query like this, would you see a problem? select   o.OrderID   , o.CustomerID   , o.Qty from Orders o where datepart( yyyy, … Continue reading

Posted in Blog | Tagged , , , ,

Common SQL Server – Not Indexing FKs

This series looks at Common SQL Server mistakes that I see many people making in SQL Server. Foreign Keys It’s way too often that I see people building databases without including declared referential integrity (DRI) in their databases. Even when … Continue reading

Posted in Blog | Tagged , , , , ,

Common SQL Server Mistakes – Equals NULL

One thing that I don’t see a lot, but it still happens with people new to SQL Server is the comparisons they’ll make with NULL values. Often those people new to T-SQL will write this: select CustomerID, CustomerName from Customers … Continue reading

Posted in Blog | Tagged , ,

Common SQL Server Mistakes – Indexing Every Column

If one index helps speed up queries, than more indexes should help more, right? They do, but they also come at a price. Both in performance during data modifications (insert/update/delete), and in terms of space since each index must be … Continue reading

Posted in Blog | Tagged , , ,

Common SQL Server Mistakes – Multi Row DML Triggers

How often have you seen someone write a DML trigger like this: create trigger mytrigger on Mytable for insert as declare @id intselect @id = id from inserted update xx set yyy = zzwhere id = @id return There seems … Continue reading

Posted in Blog | Tagged , , ,

Common SQL Server Mistakes – Shrinking Databases

I don’t like there being an easy command to shrink databases, and I especially don’t like seeing the shrink option as a part of the default maintenance plans.However it seems that this technique for managing sizes is used quite often, … Continue reading

Posted in Blog | Tagged , ,

Common SQL Server Mistakes – SELECT *

I’ve been trying to work on some new presentations so that I have a variety, including some spares, when I go to events. One of the topics that I think has some value, especially for .NET and sysadmin groups, is … Continue reading

Posted in Blog | Tagged , , ,