Monday, March 12, 2012

Placing a lock on a table

Is there any way to place a lock on a table for the duration of a certain
process (to ensure it does not get updated by anybody else), short of placin
g
the entire process in a single transaction? The process in question performe
s
data import and can run for up to 15 minutes.
Any comments are greatly appreciated.
VladTo hold a lock from a process then the process has to be in a transaction or
the lock will be dropped.
There are other ways though
e.g.
The process could put it's spid in a table. Put a trigger on the table - if
the updating spid is not in the table (and the table isn't empty) then fail
the update.
At the end of he process clear the table.
"Vlad" wrote:

> Is there any way to place a lock on a table for the duration of a certain
> process (to ensure it does not get updated by anybody else), short of plac
ing
> the entire process in a single transaction? The process in question perfor
mes
> data import and can run for up to 15 minutes.
> Any comments are greatly appreciated.
> Vlad

No comments:

Post a Comment