1
--
1.菜单表
2
3 DROP TABLE dbo.Menu
4 go
5
6
7 CREATE TABLE dbo.Menu
8 (
9 MenuID bigint NOT NULL ,
10 MenuName nvarchar ( 200 ) NULL ,
11 ParentID bigint NOT NULL ,
12 URL nvarchar ( 200 ) NULL ,
13 OrderIndex bigint NOT NULL
14 )
15 go
16
17
18 exec sp_addextendedproperty ' MS_Description ' , ' 菜单 ' , ' user ' , ' dbo ' , ' table ' , ' Menu '
19 go
20
21
22 exec sp_addextendedproperty ' MS_Description ' , ' 菜单ID ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' MenuID '
23 go
24
25
26 exec sp_addextendedproperty ' MS_Description ' , ' 菜单名称 ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' MenuName '
27 go
28
29
30 exec sp_addextendedproperty ' MS_Description ' , ' 父菜单ID ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' ParentID '
31 go
32
33
34 exec sp_addextendedproperty ' MS_Description ' , ' 超链接 ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' URL '
35 go
36
37
38 exec sp_addextendedproperty ' MS_Description ' , ' 排序 ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' OrderIndex '
39 go
40
41
42 ALTER TABLE dbo.Menu
43 ADD PRIMARY KEY (MenuID ASC )
44 go
45
46 -- 2.类别表
47 DROP TABLE dbo.Category
48 go
49
50
51 CREATE TABLE dbo.Category
52 (
53 CategoryID bigint NOT NULL ,
54 CategoryName nvarchar ( 100 ) NULL ,
55 ParentID bigint NOT NULL ,
56 OrderIndex bigint NOT NULL
57 )
58 go
59
60
61 exec sp_addextendedproperty ' MS_Description ' , ' 种类 ' , ' user ' , ' dbo ' , ' table ' , ' Category '
62 go
63
64
65 exec sp_addextendedproperty ' MS_Description ' , ' 种类ID ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' CategoryID '
66 go
67
68
69 exec sp_addextendedproperty ' MS_Description ' , ' 种类名称 ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' CategoryName '
70 go
71
72
73 exec sp_addextendedproperty ' MS_Description ' , ' 父种类ID ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' ParentID '
74 go
75
76
77 exec sp_addextendedproperty ' MS_Description ' , ' 排序 ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' OrderIndex '
78 go
79
80
81 ALTER TABLE dbo.Category
82 ADD PRIMARY KEY (CategoryID ASC )
83 go
84
85
86 -- 3.菜单里面一部分数据导到类别表中的SQL
87
88 Insert Into Category(CategoryID, CategoryName, ParentID, OrderIndex)
89 Select MenuID, MenuName, ParentID, OrderIndex
90 From Menu
91 Where MenuID < 51
92
93
2
3 DROP TABLE dbo.Menu
4 go
5
6
7 CREATE TABLE dbo.Menu
8 (
9 MenuID bigint NOT NULL ,
10 MenuName nvarchar ( 200 ) NULL ,
11 ParentID bigint NOT NULL ,
12 URL nvarchar ( 200 ) NULL ,
13 OrderIndex bigint NOT NULL
14 )
15 go
16
17
18 exec sp_addextendedproperty ' MS_Description ' , ' 菜单 ' , ' user ' , ' dbo ' , ' table ' , ' Menu '
19 go
20
21
22 exec sp_addextendedproperty ' MS_Description ' , ' 菜单ID ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' MenuID '
23 go
24
25
26 exec sp_addextendedproperty ' MS_Description ' , ' 菜单名称 ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' MenuName '
27 go
28
29
30 exec sp_addextendedproperty ' MS_Description ' , ' 父菜单ID ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' ParentID '
31 go
32
33
34 exec sp_addextendedproperty ' MS_Description ' , ' 超链接 ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' URL '
35 go
36
37
38 exec sp_addextendedproperty ' MS_Description ' , ' 排序 ' , ' user ' , ' dbo ' , ' table ' , ' Menu ' , ' column ' , ' OrderIndex '
39 go
40
41
42 ALTER TABLE dbo.Menu
43 ADD PRIMARY KEY (MenuID ASC )
44 go
45
46 -- 2.类别表
47 DROP TABLE dbo.Category
48 go
49
50
51 CREATE TABLE dbo.Category
52 (
53 CategoryID bigint NOT NULL ,
54 CategoryName nvarchar ( 100 ) NULL ,
55 ParentID bigint NOT NULL ,
56 OrderIndex bigint NOT NULL
57 )
58 go
59
60
61 exec sp_addextendedproperty ' MS_Description ' , ' 种类 ' , ' user ' , ' dbo ' , ' table ' , ' Category '
62 go
63
64
65 exec sp_addextendedproperty ' MS_Description ' , ' 种类ID ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' CategoryID '
66 go
67
68
69 exec sp_addextendedproperty ' MS_Description ' , ' 种类名称 ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' CategoryName '
70 go
71
72
73 exec sp_addextendedproperty ' MS_Description ' , ' 父种类ID ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' ParentID '
74 go
75
76
77 exec sp_addextendedproperty ' MS_Description ' , ' 排序 ' , ' user ' , ' dbo ' , ' table ' , ' Category ' , ' column ' , ' OrderIndex '
78 go
79
80
81 ALTER TABLE dbo.Category
82 ADD PRIMARY KEY (CategoryID ASC )
83 go
84
85
86 -- 3.菜单里面一部分数据导到类别表中的SQL
87
88 Insert Into Category(CategoryID, CategoryName, ParentID, OrderIndex)
89 Select MenuID, MenuName, ParentID, OrderIndex
90 From Menu
91 Where MenuID < 51
92
93