2013年6月26日
摘要: 昨晚看的书,发现可以用T-SQL 实现自定义递归,其实也就是变相的 foreach 直接上代码 ,不懂得可问: 1 declare @t table (id int ,pid int ,[name] nvarchar(50),col int ) 2 -- id 增量id pid该数据的上级增量id name 名称 3 declare @id int ,@col int 4 set @id = 2 5 set @col = 0 6 7 insert into @t select id,pid,[name],@col from dbo.CTE where id=@id 8 9 ... 阅读全文
posted @ 2013-06-26 13:24 小明@ 阅读(380) 评论(0) 推荐(0)