Click here to Skip to main content
15,885,948 members
Articles / Programming Languages / SQL

SQL Server Recursive Fetch From Self Referencing Table

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
19 Nov 2009CPOL 13.8K   6  
CREATE PROC GetChildNodes (@ID uniqueidentifier)ASBEGINWITH PermissionList (PermissionID, PermissionName, Level)AS(SELECT ap.PermissionID, ap.PermissionName, 0 AS LevelFROM Permission AS apWHERE PermissionID = @IDUNION ALLSELECT ap.PermissionID, ap.PermissionName, Level + 1FROM

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions