Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking Problem

Status
Not open for further replies.

vier

Programmer
Joined
Nov 20, 2001
Messages
2
Location
DE
High everybody;


i`ve got a problem with locking in mssqlServer 7.
I'm trying to get the folowing function:

Actualy i develop a client / server system.
in this i wan't to prevent two clients to access
the same datarow / datatable. to achive this
i extended my SQL - Strings with WITH(tablockx).
imho this should do the job; but nothing
happens. to test it i wrote two little appz;
both selecting from a table with about 30000
datasets; one selects with (tablockx) the other
without. But i still can run both of them
at the same time without any problem.

If anyone could give me advice....


TIA
Vier
 

TABLOCKX is only held for the duration of the statement or transaction. SQL will utilize work tables and will not need to hold table locks for very long. Though it may appear to you that the two statements run at the same time, they likely access the table too quickly to cause a lengthy block that can be tracked. You may need to use explicit transactions to control the duraion of the lock.

I would use locking hints cautiously in very controlled situations. You can severely impact concurrency in multiple user systems by forcing table locks. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Thanks for the advice; got it solved in another way....


Vier
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top