a retrieval procedure gets detected as action procedure

Posts   
 
    
bo2bo2 avatar
bo2bo2
User
Posts: 13
Joined: 03-Apr-2006
# Posted on: 05-Apr-2006 14:33:46   

i have this procedure that gets a list of a IDs in a self jon it gets detected as action procedure but of course i am expecting the resultset is there a way around that ?cry

here goes



ALTER PROCEDURE [dbo].[GetChildren] @unitID int
AS
BEGIN
set nocount on
create table ##temp
(
    unitID int,
    processed bit
)
insert into ##temp (unitID,processed)
select childunit_ID, 0 from unitstree where parentUnit_ID = @unitID
declare @found  bit
set @found=1
declare @foundUnitID int
while @found=1
begin
    declare children cursor for
    select unitID from ##temp where processed=0
    open children 
    fetch next from children into @foundUnitID
    while @@fetch_status=0
    begin
        insert into ##temp (unitID,processed)
        select childunit_ID, 0 from unitstree where parentUnit_ID = @foundUnitID
        update ##temp set processed=1 where unitID=@foundUnitID
        fetch next from children into @foundUnitID
    end
    close children
    deallocate children
    if exists (select unitID from ##temp where processed=0)
        set @found=1
    else
    set @found=0
end
select unitID  from ##temp
drop table ##temp
end



i also tried to execute it under another procedure but still the same

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Apr-2006 15:55:15   

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3593

Please check the above thread, it was discussing the same issue.

Thanks

bo2bo2 avatar
bo2bo2
User
Posts: 13
Joined: 03-Apr-2006
# Posted on: 05-Apr-2006 16:25:48   

thank you that workedsmile