h-you / branches / ddl / 20170712_SQL.txt @ 357
履歴 | 表示 | アノテート | ダウンロード (5.51 KB)
1 | 233 | h-you | DROP TABLE IF EXISTS personinchargemaster_OLD; |
---|---|---|---|
2 | CREATE TABLE personinchargemaster_OLD As Select * from personinchargemaster; |
||
3 | |||
4 | drop index PersonInChargeMaster_Index1 on personinchargemaster; |
||
5 | drop index PersonInChargeMaster_Index2 on personinchargemaster; |
||
6 | |||
7 | drop table if exists personinchargemaster cascade; |
||
8 | |||
9 | create table personinchargemaster ( |
||
10 | PersonCode decimal(8,0) unsigned not null comment '?S????R?[?h' |
||
11 | , DisplayOrder decimal(8,0) unsigned not null comment '?\????' |
||
12 | , PersonName varchar(60) not null comment '?S?????' |
||
13 | , StartDate date not null comment '?g?p?J?n?N????' |
||
14 | , EndDate date comment '?g?p?I???N????' |
||
15 | , PassWord varchar(16) comment '?p?X???[?h' |
||
16 | , SecurityManagement decimal(1,0) not null comment '?@????' |
||
17 | , SecCode decimal(2,0) unsigned not null comment '???????' |
||
18 | , MsgBackColor varchar(8) comment '???b?Z?[?W?w?i?F' |
||
19 | , DisplayString varchar(20) comment '?\???E???????' |
||
20 | , DepartmentCode decimal(5,0) unsigned comment '?????R?[?h' |
||
21 | , MonthlySalary decimal(11,0) not null comment '???????z' |
||
22 | , YearSalary decimal(12,0) not null comment '?N????z' |
||
23 | , Qualification varchar(120) comment '???i?????' |
||
24 | , SealPrintName varchar(5) comment '???\????' |
||
25 | , EmployeeClassFlg decimal(1,0) not null comment '?????' |
||
26 | , LedgerFlg decimal(1,0) not null comment '???v?Z???t???O' |
||
27 | , CommutingDistance decimal(5,2) not null comment '??????' |
||
28 | , CommuteCosts decimal(5,0) not null comment '??????' |
||
29 | , DeleteFlg decimal(1,0) not null comment '???t???O' |
||
30 | , EntryDate datetime not null comment '?o?^???t' |
||
31 | , UpdateDate datetime not null comment '?X?V???t' |
||
32 | , constraint personinchargemaster_PKC primary key (PersonCode) |
||
33 | ) comment '?S????}?X?^' ; |
||
34 | |||
35 | create index PersonInChargeMaster_Index1 |
||
36 | on personinchargemaster(StartDate); |
||
37 | |||
38 | create index PersonInChargeMaster_Index2 |
||
39 | on personinchargemaster(DepartmentCode); |
||
40 | |||
41 | Insert INTO personinchargemaster |
||
42 | SELECT |
||
43 | PersonCode |
||
44 | , DisplayOrder |
||
45 | , PersonName |
||
46 | , StartDate |
||
47 | , EndDate |
||
48 | , PassWord |
||
49 | , SecurityManagement |
||
50 | , SecCode |
||
51 | , MsgBackColor |
||
52 | , DisplayString |
||
53 | , DepartmentCode |
||
54 | , MonthlySalary |
||
55 | , YearSalary |
||
56 | , Qualification |
||
57 | , SealPrintName |
||
58 | , EmployeeClassFlg |
||
59 | , LedgerFlg |
||
60 | , 0 |
||
61 | , 0 |
||
62 | , DeleteFlg |
||
63 | , EntryDate |
||
64 | , UpdateDate |
||
65 | FROM personinchargemaster_OLD |
||
66 | ; |
||
67 | commit; |
||
68 | |||
69 | DROP TABLE IF EXISTS SystemMaster_OLD; |
||
70 | CREATE TABLE SystemMaster_OLD As Select * from SystemMaster; |
||
71 | DROP TABLE IF EXISTS SystemMaster; |
||
72 | |||
73 | -- ????}?X?^ |
||
74 | CREATE TABLE SystemMaster |
||
75 | ( |
||
76 | SystemCode decimal(3,0) unsigned not null comment '???R?[?h' |
||
77 | , CompanyName1 varchar(60) not null comment '?????P' |
||
78 | , CompanyName2 varchar(60) comment '?????Q' |
||
79 | , CEOName varchar(60) not null comment '??\?????' |
||
80 | , CEOPositionName varchar(60) comment '??\???E??' |
||
81 | , ZipCode varchar(8) not null comment '?X????' |
||
82 | , Address1 varchar(60) not null comment '?Z???P' |
||
83 | , Address2 varchar(60) comment '?Z??2' |
||
84 | , Address3 varchar(60) comment '?Z??3' |
||
85 | , PhoneNumber varchar(13) not null comment '?d?b???' |
||
86 | , FaxNumber varchar(13) comment 'FAX???' |
||
87 | , HomePageURL varchar(120) comment '?z?[???y?[?WURL' |
||
88 | , ConstructionExpenses decimal(4,2) not null comment '?H?????o??' |
||
89 | , OfficeExpenses decimal(4,2) not null comment '???????o??' |
||
90 | , OperatingExpenses decimal(4,2) not null comment '?c??o??' |
||
91 | , ConsumptionTax decimal(4,2) not null comment '?????' |
||
92 | , CooperationRate decimal(4,2) not null comment '???????' |
||
93 | , StatutoryWelfareRate decimal(4,2) not null comment '?@???????' |
||
94 | , FuelPrice decimal(5,2) NOT NULL COMMENT '?R???L???P??' |
||
95 | , AreaDistance decimal(5,2) NOT NULL COMMENT '????u????????' |
||
96 | , ExcelSavePath varchar(120) comment 'Excel????p?X' |
||
97 | , BusinessPeriod smallint(6) not null comment '????c?????' |
||
98 | , ConstructionYear smallint(6) not null comment '????H???N?x' |
||
99 | , BusinessBeginningDate varchar(5) not null comment '?c????????' |
||
100 | , ConstructionBeginningDate varchar(5) not null comment '?H???N?x?????' |
||
101 | , ConstructionNoBase decimal(1,0) not null comment '?H????????l' |
||
102 | , SloganString1 varchar(100) comment '?W??1' |
||
103 | , SloganString2 varchar(100) comment '?W??2' |
||
104 | , SloganString3 varchar(100) comment '?W??3' |
||
105 | , EntryDate datetime not null comment '?o?^???t' |
||
106 | , UpdateDate datetime not null comment '?X?V???t' |
||
107 | , constraint systemmaster_PKC primary key (SystemCode) |
||
108 | ) COMMENT = '????}?X?^'; |
||
109 | |||
110 | Insert INTO SystemMaster |
||
111 | SELECT |
||
112 | SystemCode |
||
113 | , CompanyName1 |
||
114 | , CompanyName2 |
||
115 | , CEOName |
||
116 | , CEOPositionName |
||
117 | , ZipCode |
||
118 | , Address1 |
||
119 | , Address2 |
||
120 | , Address3 |
||
121 | , PhoneNumber |
||
122 | , FaxNumber |
||
123 | , HomePageURL |
||
124 | , ConstructionExpenses |
||
125 | , OfficeExpenses |
||
126 | , OperatingExpenses |
||
127 | , ConsumptionTax |
||
128 | , CooperationRate |
||
129 | , StatutoryWelfareRate |
||
130 | , 0 |
||
131 | , 0 |
||
132 | , ExcelSavePath |
||
133 | , BusinessPeriod |
||
134 | , ConstructionYear |
||
135 | , BusinessBeginningDate |
||
136 | , ConstructionBeginningDate |
||
137 | , ConstructionNoBase |
||
138 | , SloganString1 |
||
139 | , SloganString2 |
||
140 | , SloganString3 |
||
141 | , EntryDate |
||
142 | , UpdateDate |
||
143 | FROM SystemMaster_OLD |
||
144 | ; |
||
145 | commit; |
||
146 | |||
147 | insert |
||
148 | into approvalmaster( |
||
149 | SELECT |
||
150 | 11 |
||
151 | , DepartmentCode |
||
152 | , SeqNo |
||
153 | , DisplayOrder |
||
154 | , ApprovalPerson |
||
155 | , ApprovalAuthority |
||
156 | , EntryDate |
||
157 | , UpdateDate |
||
158 | FROM |
||
159 | approvalmaster |
||
160 | where |
||
161 | ApprovalCode = 99 |
||
162 | ); |
||
163 | |||
164 | insert |
||
165 | into approvalmaster( |
||
166 | SELECT |
||
167 | 12 |
||
168 | , DepartmentCode |
||
169 | , SeqNo |
||
170 | , DisplayOrder |
||
171 | , ApprovalPerson |
||
172 | , ApprovalAuthority |
||
173 | , EntryDate |
||
174 | , UpdateDate |
||
175 | FROM |
||
176 | approvalmaster |
||
177 | where |
||
178 | ApprovalCode = 99 |
||
179 | ); |
||
180 | |||
181 | delete |
||
182 | from |
||
183 | approvalmaster |
||
184 | where |
||
185 | ApprovalCode >= 98; |
||
186 | |||
187 | commit; |