Table Hints for Locking

As mentioned previously in this chapter, in the “Transaction Isolation Levels in SQL Server” section, you can set an isolation level for your connection by using the SET TRANSACTION ISOLATION LEVEL command. This command sets a global isolation level for an entire session, which is useful if you want to provide a consistent isolation level for an application. However, sometimes you might want to specify different isolation levels for specific queries or for different tables within a single query. SQL Server allows you to do this by supporting table hints in the SELECT, MERGE, UPDATE, INSERT, and DELETE statements. In this way, you can override the isolation level currently set at the session level.

In this chapter, you ...

Get Microsoft® SQL Server 2012 Unleashed 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.