Link to home
Start Free TrialLog in
Avatar of daniel710624
daniel710624

asked on

Questions about ROWLOCK and Transaction Handling

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!
Avatar of imran_fast
imran_fast

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
>>Does SQL Server 2000 support multiple transactions ?
What to you mean like multi user environment.
Avatar of daniel710624

ASKER

>>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
>>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!
ASKER CERTIFIED SOLUTION
Avatar of imran_fast
imran_fast

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial