vellaima Posted March 18, 2003 Posted March 18, 2003 I have to do series of select statements and do some calculations. Based on the calculations i would like to update a table. If i have them done in a Transaction does that mean that the particular table is locked till it is committed or rolled back. Will the second user be able to do same transaction simultaneously. Please do help me out as i am confused in this issue. Thanks. Quote
*Experts* Nerseus Posted March 18, 2003 *Experts* Posted March 18, 2003 The locking during a SELECT depends on your isolation level. Look at the command "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE" (or the other 3 types of locking) for more info. You can also add the (NOLOCK) optimizer hint to your select, as in: SELECT * FROM Table1 (NOLOCK) INNER JOIN Table2 (NOLOCK) ON Table1.Col1 = Table2.Col2 Depending on the database locking, your update may lock a row or the table. SQL Server defaults to Row-Level locking (I think) so you should be Ok there, but you should probably read a few pages of the Transact SQL Help (under Query Analyzer's Help menu - easier than using Books Online sometimes). -Ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.