[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

reading table recursively and preventing modifications

pagerintas pritupimas

3/20/2007 3:13:00 PM

there is a tree structure saved in a table. table has Id and ParentId
columns, that is, table references itself. there is also a stored procedure
that uses local cursors to recursively read that table. my worry is, that
once some nodes have been read, someone else may modify them and tree will
be read in "invalid state". i need to somehow prevent others from writing to
the table, until i finished reading. i'm not sure if transactions can help
me here, since i'm not writing anything. any thoughts are welcome on this
subject. thanks :]


1 Answer

pagerintas pritupimas

3/20/2007 4:17:00 PM

0

SET TRANSACTION ISOLATION LEVEL + SERIALIZABLE or SELECT + HOLDLOCK ? :]

> there is a tree structure saved in a table. table has Id and ParentId
> columns, that is, table references itself. there is also a stored
> procedure that uses local cursors to recursively read that table. my worry
> is, that once some nodes have been read, someone else may modify them and
> tree will be read in "invalid state". i need to somehow prevent others
> from writing to the table, until i finished reading. i'm not sure if
> transactions can help me here, since i'm not writing anything. any
> thoughts are welcome on this subject. thanks :]