SQL Screw-ups: Type Mismatches

This is a continuation of the SQL Screw-ups series that stemmed from my Nashville .NET User Group talk on 03/14/2019. Slides and setup details are on the first post in the series.

SQL Server helps us out by performing implicit type conversions when it can, but how helpful is this actually? What you don’t know can hurt you when it comes to type conversion . Let’s discuss the type conversions that you may not know are happening and some tips for avoiding them.

Continue reading “SQL Screw-ups: Type Mismatches”

SQL Screw-ups: Outer Join Filters

This is a continuation of the SQL Screw-ups series that stemmed from my Nashville .NET User Group talk on 03/14/2019. Slides and setup details are on the first post in the series.

Think about the last time you needed apply additional filtering to a query based on information from some other table. You probably JOINed the additional table or added an EXISTS predicate in the WHERE clause. Let’s discuss ways you might’ve screwed it up. Continue reading “SQL Screw-ups: Outer Join Filters”

SQL Screw-ups: The Wonders of NULL

This is a continuation of the SQL Screw-ups series that stemmed from my Nashville .NET User Group talk on 03/14/2019. Slides and setup details are on the first post in the series.

The definition of null is unknown according to Microsoft documentation. That is, null represents an unknown value. It took an embarrassingly long time for me to catch a common mistake I was sometimes making regarding null. Here’s the scoop.

Continue reading “SQL Screw-ups: The Wonders of NULL”

SQL Screw-ups: Stored Procedure Misuse

This is a continuation of the SQL Screw-ups series that stemmed from my Nashville .NET User Group talk on 03/14/2019. Slides and setup details are on the first post in the series.

Imagine you’re starting a brand new project. You can make design decisions to mitigate all the issues you encountered in the legacy app you’ve been stuck working on. What a great opportunity! While the new project must integrate with the legacy app, none of the code has to match the legacy style.

Continue reading “SQL Screw-ups: Stored Procedure Misuse”

SQL Screw-ups: Scalar-Valued Functions

This is a continuation of the SQL Screw-ups series that stemmed from my Nashville .NET User Group talk on 03/14/2019. Slides and setup details are on the first post in the series.

Imagine you need to calculate the extended price for records in the Sales.SalesOrderDetail table. A simple way to get the extended price for an order line item is to multiple the order quantity by the unit price.

Continue reading “SQL Screw-ups: Scalar-Valued Functions”