摘要: 写程序是总是用到父子关系的数据,通过给定节点得到其子节点的记录,写视图但是不支持传入参数。那就用 自定义函数来完成这个需求吧!1.创建视图create Function myFunc(@id Int)Returns @tab table (id int,ParentId int,[Level] int,TName nvarchar(50))Asbegin --DECLARE @typeId int; --set @typeId =6;with cte as( select * from tab where id= @id union all select a.* from tab a, ct. 阅读全文
posted @ 2012-06-13 22:01 草青工作室 阅读(167) 评论(0) 推荐(0) 编辑