Q&A

Q1:Can I lock tables and rows myself?
A1: No. Locking is automatic. You can execute statements that obtain locks, and you can use locking hints to change locking modes and levels, but you cannot explicitly lock tables or rows.
Q2:When does it make sense to use dirty reads? It sounds like that will just create problems.
A2: Dirty reads (isolation level read uncommitted) help you perform large-scale selects against a database without running into locks or creating locks of your own. I use them to monitor performance on a production system, with the idea that I don't want to slow people down while I look around. If you need absolutely correct answers, you should avoid read uncommitted, but dirty reads are a lifesaver for quick, large selects. ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition 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.