...1, NULL, Books, '.1.'
2, 1, Computers, '.1.2.'
3, 2, Programming, '.1.2.3.'
4, 3, T_SQL, '.1.2.3.4.'
SELECT ALL elements books at category TSQL would:
SELECT * FROM ... WHERE ItemPath LIKE '%.4.%'
Please also note that recursion has limit (you can't exec call of dept can't exceed 32 calls).