Finding Mistakes

SQL Server 2005, SQL Server 2008, SQL Server 2012, SQL Server 2014, TSQL
Ever had that moment where you start getting errors from code that you've tested a million times? I had that one recently. I had this little bit of code for pulling information directly from query plans in cache: [crayon-5a6c6a1112f58384548669/] I've probably run this... I don't know how many times. But... I'm suddenly getting an error: Msg 8114, Level 16, State 5, Line 7 Error converting data type nvarchar to numeric. What the hell? There is no where this should be occurring. I dig through the query over and over and I can't figure it out. Until... I finally notice that one of the operators in the plan has the CPUCost value stored as a float: EstimateCPU="1e-006" Ummmm, since when? Since forever. I've just been lucky with my code. I'd just…
Read More

Slow Blogging

Misc
Sorry, I've been travelling for three weeks and, except for the posts around the PASS Summit, I've been blogging very intermittently. I'm back in town, all travel done. The posts will pick up from this point forward.
Read More

Serious Error

TSQL
When I wrote the book "Dissecting SQL Server Execution Plans" I knew I was going to get things wrong. Several people have pointed out things over the last couple of months. They've all been in the details. None of them were serious errors of fact. Andy Warren just found a huge one. In the section on Table Hints I detail how to apply an INDEX() hint. It's on page 123 in the electronic version or 124 of the first print version. I state that index number starts at 0 with the clustered index. That's just flat wrong. A clustered index is always 1. A 0 indicates a heap. Other indexes will have values greater than 1. If you were to supply a 0 to the INDEX() hint, as shown in the book, it forces either…
Read More