h-you / branches / ddl / 20170908_SQL.txt @ 352
履歴 | 表示 | アノテート | ダウンロード (4.84 KB)
1 | 271 | h-you | -- ??????????f?[?^ |
---|---|---|---|
2 | DROP TABLE IF EXISTS billingdatadetail_OLD; |
||
3 | CREATE TABLE billingdatadetail_OLD As Select * from billingdatadetail; |
||
4 | |||
5 | drop table if exists billingdatadetail cascade; |
||
6 | |||
7 | create table billingdatadetail ( |
||
8 | COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h' |
||
9 | , TARGETDATE decimal(6,0) default '0' not null comment '???N??' |
||
10 | , SEQNO decimal(3,0) default '0' not null comment '?A??' |
||
11 | , LINECOUNT decimal(3,0) default '0' not null comment '?s???' |
||
12 | , CONSTRUCTIONCODE decimal(10,0) comment '?H?????' |
||
13 | , CONSTRUCTIONROWCNT decimal(3,0) default '0' not null comment '?s???' |
||
14 | , CONSTRUCTIONCOLCNT decimal(3,0) default '0' not null comment '????' |
||
15 | , FIELDNAME varchar(120) comment '????' |
||
16 | , BILLPRICE decimal(10,0) comment '???????z' |
||
17 | , HIGHWPRICE decimal(10,0) comment '??????' |
||
18 | , HARDWPRICE decimal(10,0) comment '??????' |
||
19 | , INDSWASTETAX decimal(10,0) comment '?Y?p??' |
||
20 | , NOTE varchar(120) comment '???l' |
||
21 | , ENTRYDATE datetime comment '?o?^?N????' |
||
22 | , UPDATEDATE datetime comment '?X?V?N????' |
||
23 | , constraint billingdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT) |
||
24 | ) comment '??????????f?[?^' ; |
||
25 | |||
26 | |||
27 | Insert INTO billingdatadetail |
||
28 | SELECT |
||
29 | COMPANYCODE |
||
30 | , TARGETDATE |
||
31 | , SEQNO |
||
32 | , LINECOUNT |
||
33 | , CONSTRUCTIONCODE |
||
34 | , 0 |
||
35 | , 0 |
||
36 | , FIELDNAME |
||
37 | , BILLPRICE |
||
38 | , HIGHWPRICE |
||
39 | , HARDWPRICE |
||
40 | , INDSWASTETAX |
||
41 | , NOTE |
||
42 | , ENTRYDATE |
||
43 | , UPDATEDATE |
||
44 | FROM billingdatadetail_OLD |
||
45 | ; |
||
46 | commit; |
||
47 | |||
48 | |||
49 | -- ?x??????f?[?^?X?V |
||
50 | update paymentdatadetail AS A set A.CNSTRPRICEEXIST = -1 where A.CNSTRPRICEEXIST is null; |
||
51 | commit; |
||
52 | |||
53 | |||
54 | -- ?o?????f?[?^ |
||
55 | drop table if exists attendancedailydata cascade; |
||
56 | |||
57 | create table attendancedailydata ( |
||
58 | PersonCode decimal(8,0) unsigned not null comment '????R?[?h' |
||
59 | , AttendanceDate date not null comment '???????' |
||
60 | , SeqNo decimal(3,0) unsigned not null comment '????s???' |
||
61 | , ActionResult varchar(30) not null comment '?s??????' |
||
62 | , StartTime datetime comment '?J?n????' |
||
63 | , CompTime datetime comment '?I??????' |
||
64 | , DayTimes decimal(4,1) not null comment '????????v????' |
||
65 | , WorkingComment varchar(120) comment '?R?????g' |
||
66 | , NightFlg decimal(1,0) not null comment '?????t???O' |
||
67 | , EntryDate datetime not null comment '?o?^???t' |
||
68 | , UpdateDate datetime not null comment '?X?V???t' |
||
69 | , constraint attendancedailydata_PKC primary key (PersonCode,AttendanceDate,SeqNo) |
||
70 | ) comment '?o?????f?[?^' ; |
||
71 | |||
72 | create index AttendDaily_Index1 |
||
73 | on attendancedailydata(ActionResult); |
||
74 | |||
75 | create index AttendDaily_Index2 |
||
76 | on attendancedailydata(AttendanceDate); |
||
77 | |||
78 | |||
79 | -- ?H???{?H?\?Z?f?[?^ |
||
80 | DROP TABLE IF EXISTS constructionbudget_OLD; |
||
81 | CREATE TABLE constructionbudget_OLD As Select * from constructionbudget; |
||
82 | |||
83 | drop table if exists constructionbudget cascade; |
||
84 | |||
85 | create table constructionbudget ( |
||
86 | ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
||
87 | , CreatorCode decimal(8,0) not null comment '????R?[?h' |
||
88 | , CreatorName varchar(60) comment '?????' |
||
89 | , CreatorCosts decimal(11,0) not null comment '??????^' |
||
90 | , AssistantCode decimal(8,0) not null comment '???S????R?[?h' |
||
91 | , AssistantName varchar(60) comment '???S?????' |
||
92 | , AssistantCosts decimal(11,0) not null comment '???S??????^' |
||
93 | , InstructorCode decimal(8,0) not null comment '?H???w?????R?[?h' |
||
94 | , InstructorName varchar(60) comment '?H???w??????' |
||
95 | , InstructorCosts decimal(11,0) not null comment '?H???w???????^' |
||
96 | , CreateDate date not null comment '????' |
||
97 | , ConstructionTimes decimal(5,2) not null comment '?H???i?P??E???j' |
||
98 | , ConstructionStart date not null comment '?_??H???J?n' |
||
99 | , ConstructionEnd date not null comment '?_??H??????' |
||
100 | , InstructorTimes decimal(5,2) not null comment '?w???????????' |
||
101 | , SalaryFlg decimal(1,0) not null comment '???^?U????' |
||
102 | , SalaryDays decimal(4,0) not null comment '?U??????' |
||
103 | , A_SalaryFlg decimal(1,0) not null comment '???S??????^?U????' |
||
104 | , A_SalaryDays decimal(4,0) not null comment '???S????U??????' |
||
105 | , I_SalaryFlg decimal(1,0) not null comment '?w???????^?U????' |
||
106 | , I_SalaryDays decimal(4,0) not null comment '?w?????U??????' |
||
107 | , OrdersDecisionPrice decimal(12,0) not null comment '??????????z' |
||
108 | , EntryDate datetime not null comment '?o?^???t' |
||
109 | , UpdateDate datetime not null comment '?X?V???t' |
||
110 | , constraint constructionbudget_PKC primary key (ConstructionCode) |
||
111 | ) comment '?H???{?H?\?Z?f?[?^' ; |
||
112 | |||
113 | Insert INTO constructionbudget |
||
114 | SELECT |
||
115 | ConstructionCode |
||
116 | , CreatorCode |
||
117 | , CreatorName |
||
118 | , CreatorCosts |
||
119 | , AssistantCode |
||
120 | , AssistantName |
||
121 | , AssistantCosts |
||
122 | , InstructorCode |
||
123 | , InstructorName |
||
124 | , InstructorCosts |
||
125 | , CreateDate |
||
126 | , ConstructionTimes |
||
127 | , ConstructionStart |
||
128 | , ConstructionEnd |
||
129 | , InstructorTimes |
||
130 | , SalaryFlg |
||
131 | , SalaryDays |
||
132 | , A_SalaryFlg |
||
133 | , A_SalaryDays |
||
134 | , I_SalaryFlg |
||
135 | , I_SalaryDays |
||
136 | , 0 |
||
137 | , EntryDate |
||
138 | , UpdateDate |
||
139 | FROM constructionbudget_OLD |
||
140 | ; |
||
141 | commit; |