SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Set Transaction Isolation Level for UPDATE or DELETE statements


Set Transaction Isolation Level for UPDATE or DELETE statements

Author
Message
Ivan Parra
Ivan Parra
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 27
I know if I use the "Set Transaction Isolation Level" (using Read Uncommitted, or Read Committed, or whatever), l don't need to write lock hints in every table used in every SELECT statement.

I read in a page that it works only for SELECT statements, but an UPDATE statement can have joined several tables and I want to avoid of using Lock hints in every joined table

Check the following example:

Set Transaction Isolation Level Read Uncommitted

Update EmployeeSalaries WITH (RowLock,ReadCommitted) Set
DailySalary = DailySalary * 1.15
From EmployeeSalaries
Inner Join Employees On Employees.EmpID = EmployeeSalaries.EmpID
Inner Join Departments On Departments.DepartmentID = Employees.DepartmentID
Where Employees.DepartmentName = 'HR'

Using the example, I want to know if the Set Transaction Isolation Level READ UNCOMMITTED works for all the tables joined in this UPDATE statement (Employees and Departments)?
Ivan Parra
Ivan Parra
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 27
The answer is YES, the Set Transaction Isolation Level works for the joined tables in the UPDATE statement, I couldn't found an answer in books or pages in internet, I had to prove myself

Also, It works for the joined tables in DELETE and INSERT statements, even Subqueries used in any of these statements

I hope this be helpful
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search