You are here: Re: Stored Procedure to return table? « MsSQL Server « IT news, forums, messages
Re: Stored Procedure to return table?

Posted by Jack Turnbull on 08/31/06 15:17

Thanks Ed,

Put me on the right track - ended up creating a function that returned a
table using your iteration.

Thanks,
Jack

"Ed Murphy" <emurphy42@socal.rr.com> wrote in message
news:URAJg.6350$S_5.5724@tornado.socal.rr.com...
>
> Yes.
> </pedant>
>
> declare @ancestor_id int, @candidate_id int
> set @ancestor_id = @id
> set @candidate_id = @id
> while @candidate_id is not null
> begin
> set @candidate_id = (
> select ParentID
> from table
> where id = @ancestor_id
> )
> if @candidate_ancestor_id is not null
> begin
> set @ancestor_id = @candidate_id
> end
> end

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация