Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Lock in the select statement

Author  Topic 

devteam
Starting Member

15 Posts

Posted - 2006-02-09 : 01:02:44
Hi all,

I am using sql server 2000. i have a method in java which is used to retrieve the error_key,error_parent_key value from the database.
i have stored 0 as the parent key value for an error key..
someof the error key are having nested parent keys.

if parent key have nested parent key then i will call the same method again to retrieve the parent key. so like wise i will call my method recursively. after few hours, when i accessed the method continouosly, select query is keep on running. why is there any lock in sql server?

can u please help me...

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-09 : 01:21:43
can you post your query ?

----------------------------------
'KH'


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-09 : 01:40:03
See if this helps
http://www.nigelrivett.net/RetrieveTreeHierarchy.html

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

devteam
Starting Member

15 Posts

Posted - 2006-02-09 : 04:44:52

Hi,

My query is

Sample coding:
geterrorparentkey(err_key)
{
Query=select error_key,error_parent_key from errors where error_key=err_key;

if(error_parent_key!=0)
{
geterrorparentkey(error_parent_key)
}
}

if the query returns parent key value other than 0 then i will pass the parent key to the method and find out the nested keys.

This method will be break once the parent key returns as 0.

quote:
Originally posted by khtan

can you post your query ?

----------------------------------
'KH'




Go to Top of Page
   

- Advertisement -