h-you / branches / ddl / 20171207_SQL.txt @ 311
履歴 | 表示 | アノテート | ダウンロード (1.87 KB)
1 |
-- ??????????f?[?^ |
---|---|
2 |
DROP TABLE IF EXISTS purchaseorderdetail_OLD; |
3 |
CREATE TABLE purchaseorderdetail_OLD As Select * from purchaseorderdetail; |
4 |
|
5 |
drop table if exists purchaseorderdetail cascade; |
6 |
|
7 |
create table purchaseorderdetail ( |
8 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
9 |
, SeqNo decimal(3,0) unsigned not null comment '???????}??' |
10 |
, GroupCount decimal(1,0) not null comment '?O???[?v???' |
11 |
, LineCount decimal(3,0) unsigned not null comment '?s???' |
12 |
, ComponentCode decimal(5,0) unsigned not null comment '?\???L?[' |
13 |
, ItemCode decimal(5,0) unsigned not null comment '?H??L?[' |
14 |
, FirstString varchar(120) comment '?H??E?i??' |
15 |
, SecondString varchar(120) comment '???e????' |
16 |
, UnitCount decimal(8,2) not null comment '????' |
17 |
, UnitName varchar(30) comment '?P??' |
18 |
, UnitPrice decimal(10,0) not null comment '?P??' |
19 |
, OrdersLinePrice decimal(12,0) comment '???z' |
20 |
, SourceCode decimal(10,0) unsigned not null comment '?\?Z?????H?????' |
21 |
, SourceLineCnt decimal(3,0) unsigned not null comment '?????????????s???' |
22 |
, DataTypeFlag decimal(1,0) unsigned not null comment '?f?[?^?^?C?v?t???O' |
23 |
, EntryDate datetime not null comment '?o?^???t' |
24 |
, UpdateDate datetime not null comment '?X?V???t' |
25 |
, constraint purchaseorderdetail_PKC primary key (ConstructionCode,SeqNo,GroupCount,LineCount) |
26 |
) comment '??????????f?[?^' ; |
27 |
|
28 |
create index POrderDetail_Index1 |
29 |
on purchaseorderdetail(SourceCode); |
30 |
|
31 |
Insert INTO purchaseorderdetail |
32 |
SELECT |
33 |
ConstructionCode |
34 |
, SeqNo |
35 |
, GroupCount |
36 |
, LineCount |
37 |
, ComponentCode |
38 |
, ItemCode |
39 |
, FirstString |
40 |
, SecondString |
41 |
, UnitCount |
42 |
, UnitName |
43 |
, UnitPrice |
44 |
, OrdersLinePrice |
45 |
, SourceCode |
46 |
, SourceLineCnt |
47 |
, 0 |
48 |
, EntryDate |
49 |
, UpdateDate |
50 |
FROM purchaseorderdetail_OLD |
51 |
; |
52 |
update purchaseorderdetail set DataTypeFlag = 1 where FirstString like '%?@??%'; |
53 |
|
54 |
commit; |