Solved

Questions about ROWLOCK and Transaction Handling

Posted on 2006-11-28
5
1,267 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

803 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