Hello World!

sqlserver 2005无限极分类 获取 所有子分类

/***2005以上版本有效***/
CREATE procedure [dbo].[GetFolderChilds]
(
	@folderid uniqueidentifier
)
as
begin
with T as
(
SELECT * FROm Doc_Folder where FolderID  = @folderid
union all
select a.* from Doc_Folder a join T b on a.ParentFolderID = b.FolderID
)
select * from T

end
return 


GO

 

posted @ 2012-08-03 18:11  世界万物  阅读(225)  评论(0编辑  收藏  举报
Bye World!