h-you / branches / ddl / 20180507_SQL.txt @ 364
履歴 | 表示 | アノテート | ダウンロード (2.58 KB)
1 |
-- ?H???S????X?????f?[?^ |
---|---|
2 |
drop table if exists constrchgcharge cascade; |
3 |
drop table if exists ChgConstrCharge cascade; |
4 |
|
5 |
create table ChgConstrCharge ( |
6 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
7 |
, Division decimal(1,0) not null comment '????' |
8 |
, SeqNo smallint(5) unsigned not null comment '?A??' |
9 |
, DepartmentCode decimal(5,0) unsigned not null comment '?????R?[?h' |
10 |
, PersonCode decimal(8,0) not null comment '?S????R?[?h' |
11 |
, StartDate date comment '?S???J?n?N????' |
12 |
, CompDate date comment '?S???I???N????' |
13 |
, EntryDate datetime not null comment '?o?^???t' |
14 |
, UpdateDate datetime not null comment '?X?V???t' |
15 |
, constraint ChgConstrCharge_PKC primary key (ConstructionCode,Division,SeqNo) |
16 |
) comment '?H???S????X?????f?[?^' ; |
17 |
|
18 |
-- ?\?Z???W?v?R?[?h?}?X?^ |
19 |
drop table if exists BudgetSumCode cascade; |
20 |
|
21 |
CREATE TABLE BudgetSumCode( |
22 |
BlockCode DECIMAL (2, 0) UNSIGNED NOT NULL COMMENT '?u???b?N???' |
23 |
, GroupCode DECIMAL (2, 0) UNSIGNED NOT NULL COMMENT '?O???[?v???' |
24 |
, ComponentCode DECIMAL (5, 0) UNSIGNED NOT NULL COMMENT '?\???L?[' |
25 |
, ItemCode DECIMAL (5, 0) UNSIGNED NOT NULL COMMENT '?H??L?[' |
26 |
, ElementsName VARCHAR (100) NOT NULL COMMENT '?v?f????' |
27 |
, EntryDate DATETIME NOT NULL COMMENT '?o?^???t' |
28 |
, UpdateDate DATETIME NOT NULL COMMENT '?X?V???t' |
29 |
, CONSTRAINT BudgetSumCode_PKC PRIMARY KEY (BlockCode, GroupCode, ComponentCode, ItemCode) |
30 |
) COMMENT '?\?Z???W?v?R?[?h?}?X?^'; |
31 |
|
32 |
-- ?H?????}?X?^ |
33 |
DROP TABLE IF EXISTS constructiontypemaster_OLD; |
34 |
CREATE TABLE constructiontypemaster_OLD As |
35 |
Select |
36 |
* |
37 |
from |
38 |
constructiontypemaster; |
39 |
|
40 |
drop table if exists constructiontypemaster cascade; |
41 |
|
42 |
create table constructiontypemaster ( |
43 |
TypeCode decimal(5,0) unsigned not null comment '?H?????R?[?h' |
44 |
, DisplayOrder decimal(5,0) unsigned not null comment '?\????' |
45 |
, NameString varchar(100) not null comment '????' |
46 |
, PublicFlg decimal(1,0) not null comment '?????t???O' |
47 |
, RepairFlg decimal(1,0) not null comment '?V?z?E???C?t???O' |
48 |
, SecRank decimal(1,0) not null comment '?????????N' |
49 |
, ExpensesLink decimal(1,0) not null comment '?o??g?p??' |
50 |
, DeleteFlg decimal(1,0) not null comment '???t???O' |
51 |
, EntryDate datetime not null comment '?o?^???t' |
52 |
, UpdateDate datetime not null comment '?X?V???t' |
53 |
, constraint constructiontypemaster_PKC primary key (TypeCode) |
54 |
) comment '?H?????}?X?^' ; |
55 |
|
56 |
Insert |
57 |
INTO constructiontypemaster |
58 |
Select |
59 |
TypeCode |
60 |
, DisplayOrder |
61 |
, NameString |
62 |
, PublicFlg |
63 |
, 0 |
64 |
, SecRank |
65 |
, ExpensesLink |
66 |
, DeleteFlg |
67 |
, EntryDate |
68 |
, NOW() |
69 |
from |
70 |
constructiontypemaster_OLD; |