Problems with Stored Procedures

Nearly all programming languages have little problematic things. I can't point out all these things in this chapter—you will have to find and take care of a lot of them on your own. What I can do is point out some of the ones that I have found so that you can avoid them.

Some of the big problems I have found in T-SQL have to do with concurrency. These problems usually come around due to issues introduced by the developer, such as long-running stored procedures, but manifest themselves as problems with the database itself, such as a large amount of blocking. The following sections hit on two of these problems: excessive blocking and sequential numbering in a table.

Blocking

As you know, when data modification is ...

Get Writing Stored Procedures for Microsoft SQL Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.