Sample script that compares locking and repeatable reads. Range locks (serializable) disallows inserting in the range, while key locks (r repeatable reads) allow inserts (also known as phantoms). This script, contributed by Microsoft's Tom Davidson, requires SQL Server 2005.

Visual Basic
Edit|Remove
set lock_timeout 5000
go
begin tran
go
Insert into [Order Details]
values (50001,51,42.00,10,0)
go
-- rollback