Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Restrict simultaneous access to resources

By NPeeters,

This set of procedures allow you to control simultaneous access to any resource you are using. It mimics the behaviour of a Semaphore in programming.

A typical problem where you need this, is when you have a computational intensive procedure you only want to be started a limited number of times.

First, add a record to the Semaphore table, identifying the maximum number of simultaneous 'users' of the resource.
Whenever you need access to that specific resource, you add a call to usp_LockSemaphore to the beginning of your call. If the procedure returns 0 (zero), you can continue using the resource.
After the resource is no longer used, call usp_UnlockSemaphore.

Total article views: 252 | Views in the last 30 days: 2
 
Related Articles
FORUM

Resource Governor

Resource Governor

FORUM

Resource database ?

Resource database ?

BLOG

SQL Resource

By now, I am sure that you are well aware of the Resource Database.  Starting with SQL Server 2005, ...

FORUM

need help about procedure

procedure

BLOG

Resource database

Today learned new thing about Resource database, as everybody knows resource database is the system ...

 
Contribute