Articles

Page 1 of 11 — showing articles 1 to 18 of 194

Sharing Data Between Procedures using a Cursor

A cursor variable, like this rabbit's cake, can be shared selectively

Contrary to the product documentation, SQL Server cursor variables can be used to share data between stored procedures in the input or output direction (but not both).

MERGE Bug with Updates Through a View

Warning! MERGE Ahead

A bug with MERGE that causes SQL Server to try to update a non-existent row, leading to database corruption or a retail assertion, stack dump, and connection termination.

How a Lazy Index Spool Works

Lazy Spools

Exploring the internal layout of a Lazy Index Spool's worktable, answering how it distinguishes a NULL result from an empty one.

Improved RCSI Ghost Cleanup in SQL Server 2022

Isolated ghost story

An example of poor update performance under RCSI as compared with locking read committed. Details of an improvement in SQL Server 2022 that can help avoid the worst effects.

SQL Server Forced Plans Overwite the Query Hash

Four Muppets of the Apocalypse

A 16-year old SQL Server bug that means 'forced plans' have the query plan hash in place of the expected query hash. Includes an explanation and discussion of the term 'morally equivalent plan'.

Why a Self-Join Requires Halloween Protection

A Halloween Scene

I was asked recently why Halloween Protection was needed for data modification statements that include a self-join of the target table. This gives me a chance to explain, while also covering some interesting product bug history from the SQL Server 7 and 2000 days.