What's In Your SQL Server Library?

2016-09-29 0 Comments

Team Foundation Server - DefaultCollection

When you're faced with a new task or some other SQL Server challenge you've not tackled before, what's your go-to strategy: Author your own solution? Or use someone else's? There's no right or wrong answer. Each option comes with its own pluses and minuses. The more interesting question is this:


Part 2: Enhanced T-SQL Error Handling With Extended Events

2016-09-18 0 Comments

TSQL Error Handling With Extended Events

In the last post, we explored a couple of examples of using Extended Events to enhance T-SQL error handling. There was some potential there. But a hard-coded SPID was necessary: we couldn't use the code examples for anything automated. It was cumbersome, too. Let's change that, shall we?


Enhanced T-SQL Error Handling With Extended Events

2016-09-14 0 Comments

T-SQL TRY...CATCH with Extended Events

In the previous post, I examined a couple of error handling scenarios in T-SQL that don't work as expected with TRY...CATCH. The first problem involved multiple errors for a single statement in the TRY block: when control transferred to the CATCH block, only one error was accounted for. The second problem involved multiple errors caused by DBCC CHECKDB on a corrupt database. The TRY block "ate" all the errors and control never transferred to the CATCH block, leaving the impression there were no errors at all. Now let's look at a way to enhance error handling with Extended Events to overcome the shortcomings of TRY...CATCH for the two scenarios.


The Unfulfilled Promise of TRY...CATCH

2016-09-07 0 Comments

TRY...CATCH is not working

I've known for quite a while that there are issues with TRY...CATCH for T-SQL. I've had my share of frustrations with it, and I am clearly not alone. Just check out some of these Microsoft Connect items: 1 2, 3, 4, 5, 6, 7, 8, 9, 10. Five of them are Closed As Won't Fix, three of them are Active (all three were opened more than 8 years ago), and the other two are Closed By Design.