Help with a t-sql query
- by user324650
Hi
Based on the following table
Path
----------------------
area1
area1\area2
area1\area2\area3
area1\area2\area3\area4
area1\area2\area5
area1\area2\area6
area1\area7
Input to my stored procedure is areapath and no.of children (indicates the depth that needs to considered from the input areapath)
areapath=area1
children=2
Above should give
Path
-----------
area1
area1\area2
area1\area2\area3
area1\area2\area5
area1\area2\area6
area1\area7
similary for
areapath=area2 and children=1 output should be
Path
---------------
area1\area2
area1\area2\area3
area1\area2\area5
area1\area2\area6
I am confused how to write a query for this one.