March 10, 2010 at 12:04 pm
Suppose I have an UPDATE query like this:
UPDATE Table1
SET Table1.field1 = Whatever
FROM Table1 INNER JOIN Table2
WHERE Table1.ID = Table2.ID
This type of query is being performed by a DTS package several times a day.
At the same time, there are users that INSERT records into Table2 using an application.
Question 1:
Seeing that it's only one field in Table1 that's being updated, is Table2 locked at any time during the UPDATE?
Question 2:
If the UPDATE query above were wrapped within a TRANSACTION, would Table2 be locked at any time?
Thanks!
March 10, 2010 at 12:21 pm
March 11, 2010 at 7:35 am
A shared lock will have to be taken on Table2 resources in any situation. Think about it this way, you are updating table1 based the relationship with table2. You don't want changes made to Table2 that could affect the rows that are updated in table1.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply