Most T-SQL Queries Don’t Even Try to Handle Errors.


David Tovee asked a great question in yesterday’s Mastering Query Tuning class. He asked his fellow students, “How many of you actually use TRY/CATCH?”

I turned it into a Twitter poll because I wanted to check a wider audience:

When the developers at my company write new queries, they use TRY/CATCH and exception handling:

— Brent Ozar (@BrentO) August 19, 2021

The poll results as of this writing mirrors the experience I see with clients: the vast majority of T-SQL code doesn’t have any error handling whatsoever.

When I do run across error handling in client queries,