Solved

Questions about ROWLOCK and Transaction Handling

Posted on 2006-11-28
5
1,252 Views
Last Modified: 2008-01-09
Dear Sir,
  The SQL statement:
     SELECT TITLE, DESC
      FROM BAEXP_TITLE
        WITH (UPDLOCK, ROWLOCK, NOWAIT)
      WHERE COMPANY = 'ABC' AND TITLE = 'XYZ'

  Questions:
  1. Does (UPDLOCK ROWLOCK NOWAIT) without comma also work ?
  2. What is the diffrence between (UPDLOCK, ROWLOCK) and (UPDLOCK, ROWLOCK, NOWAIT) ?
  3. Does SQL Server 2000 support multiple transactions ? If so, any settings need to be done first ?

Thanks for you help!
0
Comment
Question by:daniel710624
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:imran_fast
ID: 18035376
1,  No for each hint you have to provide comman in between
2, The first one also include nowait hint along with UPDLOCk and ROWLOCK
3. Yes, No
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 18035378
>>Does SQL Server 2000 support multiple transactions ?
What to you mean like multi user environment.
0
 

Author Comment

by:daniel710624
ID: 18035719
>>Does SQL Server 2000 support multiple transactions ?
>>What to you mean like multi user environment.
I mean can I start two transactions with different TransactionID at the same time?
A nested transactions looks like :
  START TRANS 1
    DO PROCESS1
    START TRANS 2
      DO PROCESS2
    IF PROCESS2 COMPLETED THEN
      COMMIT TRANS 2
    ELSE
      ROLLBACK TRANS 2
  IF PROCESS1 AND PROCESS2 COMPLETED THEN
    COMMIT TRANS 1
  ELSE
    ROLLBACK TRANS 1
0
 

Author Comment

by:daniel710624
ID: 18035738
>>1,  No for each hint you have to provide comman in between
But there was no error occured when executed the statement without comma...That confused me!
So, (UPDLOCK, ROWLOCK, NOWAIT) is the correct one!
0
 
LVL 28

Accepted Solution

by:
imran_fast earned 500 total points
ID: 18036344
>>So, (UPDLOCK, ROWLOCK, NOWAIT) is the correct one!
yes

No for such transactions it will be in a serial.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now