SqlServer创建树形结构表

2014-10-24 20:52:28  访问(1894) 赞(0) 踩(0)

--| create table 脚本 |--

drop table dbo.UTB_V_BASIC_USED_DEP;

--+ 创建表(EKVEHICLE.CAR_GASFEE) |--
create table dbo.UTB_V_BASIC_USED_DEP 
(
	ID	bigint not null primary key,	-- 使用部门 --
	TheName nvarchar(255) not null ,	-- 名称 --
    PID bigint not null ,				-- 父节点 --
    Layer int not null ,				-- 层数 --
    Path nvarchar(4000) not null ,		-- 树路径 --
    ShowSeq int not null ,				-- 排序 --
    Remark nvarchar(4000) ,				-- 备注 --
    CreateTime datetime default getdate() not null,	-- 创建时间 --
    UpdateTime datetime default getdate() not null	-- 修改时间 --
); 

--+ [表]UTB_V_BASIC_USED_DEP:使用部门 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'使用部门', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', NULL, NULL;

--+ ID:使用部门 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'使用部门', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'ID';

--+ TheName:名称 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'名称', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'TheName';

--+ PID:父节点 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'父节点', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'PID';

--+ Layer:层数 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'层数', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'Layer';

--+ Path:树路径 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'树路径', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'Path';

--+ ShowSeq:排序 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'排序', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'ShowSeq';

--+ Remark:备注 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'备注', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'Remark';

--+ CreateTime:创建时间 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'创建时间', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'CreateTime';

--+ UpdateTime:修改时间 |-- 
EXECUTE sp_addextendedproperty N'MS_Description', N'修改时间', N'user', N'dbo', N'table', N'UTB_V_BASIC_USED_DEP', 'column', 'UpdateTime';



-- 创建[表格:UTB_V_BASIC_USED_DEP] seq_v_basic_used_dep -- 
insert into utb_sys_dual (SequenceName, ID, CreateTime, UpdateTime, TableName) values 
    (
        'seq_v_basic_used_dep', 1, getdate(), getdate(), 'UTB_V_BASIC_USED_DEP'
    );


标签:SqlServer脚本    SqlServer创建树行结构    SQL脚本 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)