Groups | Blog | Home
all groups > sql server programming > january 2004 >

sql server programming : Select queries and locking.


Steve Thompson
1/5/2004 12:39:36 PM
[quoted text, click to view]

I'm not sure why you'd want to do that, however you can use Table Hints to
accomplish that... please see BOL for more details.

Steve

srihari
1/5/2004 9:54:27 PM
Just wanted to know if this is possible.
In my stored procedure lets say I fire the below select query :
"SELECT * FROM EMP where EmpName = 'Nilesh'"

and before my stored procedure completes execution. If another user fires
the same select query, his call should wait. However if he fires a SELECT
query for an employee with another name his call should succeed.

Is this possible ?

Thanks
Srihari


James Hokes
1/5/2004 9:58:23 PM
Table hints will not work for this.

One possibility: route everything through stored procedures, and use the new
sp_getapplock and sp_releaseapplock. You could use the person's last name as
the resource name to lock, or employeeid, or whatever.

James Hokes

[quoted text, click to view]

AddThis Social Bookmark Button