摘要:
--建立測試環境Create Table A(IDInt,fatherIDInt,NameVarchar(10))Insert A Select 1, NULL, 'tt'Union All Select 2, 1, 'aa'Union All Select 3, 1, 'bb'Union All Select 4, 2, 'cc'Union All Select 5, 2, 'gg'Union ... 阅读全文
摘要:
函数CREATE FUNCTION GetChildren (@id varchar(20))RETURNS @t table(id varchar(20)) AS BEGIN insert @t select subid from tree where parentid = @id while @@rowcount > 0 insert @t select a.subid from tr... 阅读全文