You are here: Recursive Stored Procedure? « MsSQL Server « IT news, forums, messages
Recursive Stored Procedure?

Posted by Henrik Juul on 10/16/06 11:15

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

 

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

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