Posted by Henrik Juul on 10/16/06 11:32
Thanx Kristian.
Can you show me how??
Regards
Henrik
"Kristian Damm Jensen" <kristiandamm@mail.dk> wrote in message
news:45336c4f$0$904$edfadb0f@dread12.news.tele.dk...
> Henrik Juul wrote:
>> How do I call my Stored Procedure recursively:
>>
>> CREATE PROCEDURE dbo.GetParentIONode
>> (
>> @IONodeID int,
>> @FullNodeAddress char(100) OUTPUT
>> )
>>
>> AS
>> BEGIN
>> DECLARE @ParentIONodeID int
>> IF EXISTS (SELECT ParentIONodeID FROM IONodes WHERE IONodeID =
>> @IONodeID) BEGIN
>> SET @FullNodeAddress = CAST((SELECT ParentIONodeID FROM IONodes WHERE
>> IONodeID = @IONodeID) AS VARCHAR) + ' / ' + @FullNodeAddress
>> --CALL SP Again with @ParentIONodeID and @FullNodeAddress until
>> ParentIONodeID = NULL
>> SELECT @FullNodeAddress
>> END
>> END
>> GO
>
> Like you would call any other stored procedure. But you can't use the
> result set from a stored procedure directly in your where clause. You have
> to store it in a temptable.
>
> --
> Regards,
> Kristian Damm Jensen
> "This isn't Jeopardy. Answer below the question."
>
Navigation:
[Reply to this message]
|