日期:2014-05-16 浏览次数:20655 次
CREATE TABLE [UserName] ([Id] int,[Name] [nvarchar](50))
insert into [UserName]
select 1, '杜玲利' union all
select 2, '唐红' union all
select 3, '李小林' union all
select 4, '张光' union all
select 5, '王涛' union all
select 6, '贾云' union all
select 7, '张明华'union all
select 8, '陈星' union all
select 9, '李春华'
CREATE TABLE [Compay] ([Id] int,[Name] [nvarchar](50),[ParentId] int,[Tree] int)
insert into [Compay]
select 1, '总部', 0, 0 union all
select 2, '上海分公司', 1, 1 union all
select 3, '总部-人事部', 1, 1 union all
select 4, '上海分公司-销售部', 2, 2 union all
select 5, '上海分公司-电脑部', 2, 2 union all
select 6, '上海分公司-电脑部-电脑1部', 5, 3 union all
select 7, '上海分公司-电脑部-电脑1部-精英组', 6, 4
CREATE TABLE [User_Compay] ([Id] int,[UserId] int,[CompayId] int)
insert into [User_Compay]
select 1, 1, 3 union all
select 2, 7, 1 union all
select 3, 3, 2 union all
select 4, 5, 4 union all
select 5, 2, 6 union all
select 6, 4, 5 union all
select 7, 6, 7 union all
select 8, 8, 2 union all
select 9, 9, 5