I did this... DECLARE @childFolders table ( id int identity, folderID int ) INSERT INTO @childFolders SELECT FolderID FROM tbl_Folders WHERE ParentID = @parentID DECLARE @index int, @count int SELECT @count = count(*) FROM @childFolders SET @index = 1 WHILE @index <= @count BEGIN SELECT @parentID = FolderID FROM @childFolders WHERE id = @index EXEC sp_PropagateFolder @parentID, @rootFolderID, @permissionFolderID SET @index = @index + 1 END
But perhaps the benifit of the the simpler index increment is outweighed by the extra overhead of the identity column.