h-you / branches / ddl / 20171024_SQL.txt @ 332
履歴 | 表示 | アノテート | ダウンロード (2.44 KB)
| 1 | 302 | h-you | -- ???????f?[?^ |
|---|---|---|---|
| 2 | DROP TABLE IF EXISTS billingdata_OLD; |
||
| 3 | CREATE TABLE billingdata_OLD As Select * from billingdata; |
||
| 4 | |||
| 5 | drop table if exists billingdata cascade; |
||
| 6 | |||
| 7 | create table billingdata ( |
||
| 8 | COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h' |
||
| 9 | , TARGETDATE decimal(6,0) default '0' not null comment '???N??' |
||
| 10 | , PAYMENTKIND decimal(1,0) default '0' not null comment '?x????' |
||
| 11 | , SEQNO decimal(3,0) default '0' not null comment '?A??' |
||
| 12 | , BILLPRICE decimal(10,0) comment '???????z' |
||
| 13 | , ENTRYDATE datetime comment '?o?^?N????' |
||
| 14 | , UPDATEDATE datetime comment '?X?V?N????' |
||
| 15 | , constraint billingdata_PKC primary key (COMPANYCODE,TARGETDATE,PAYMENTKIND,SEQNO) |
||
| 16 | ) comment '???????f?[?^' ; |
||
| 17 | |||
| 18 | Insert INTO billingdata |
||
| 19 | SELECT |
||
| 20 | COMPANYCODE |
||
| 21 | , TARGETDATE |
||
| 22 | , 0 |
||
| 23 | , SEQNO |
||
| 24 | , BILLPRICE |
||
| 25 | , ENTRYDATE |
||
| 26 | , UPDATEDATE |
||
| 27 | FROM billingdata_OLD |
||
| 28 | ; |
||
| 29 | commit; |
||
| 30 | |||
| 31 | |||
| 32 | -- ??????????f?[?^ |
||
| 33 | DROP TABLE IF EXISTS billingdatadetail_OLD; |
||
| 34 | CREATE TABLE billingdatadetail_OLD As Select * from billingdatadetail; |
||
| 35 | |||
| 36 | drop table if exists billingdatadetail cascade; |
||
| 37 | |||
| 38 | create table billingdatadetail ( |
||
| 39 | COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h' |
||
| 40 | , TARGETDATE decimal(6,0) default '0' not null comment '???N??' |
||
| 41 | , PAYMENTKIND decimal(1,0) default '0' not null comment '?x????' |
||
| 42 | , SEQNO decimal(3,0) default '0' not null comment '?A??' |
||
| 43 | , LINECOUNT decimal(3,0) default '0' not null comment '?s???' |
||
| 44 | , CONSTRUCTIONCODE decimal(10,0) comment '?H?????' |
||
| 45 | , CONSTRUCTIONROWCNT decimal(3,0) default '0' not null comment '?s???' |
||
| 46 | , CONSTRUCTIONCOLCNT decimal(3,0) default '0' not null comment '????' |
||
| 47 | , FIELDNAME varchar(120) comment '????' |
||
| 48 | , BILLPRICE decimal(10,0) comment '???????z' |
||
| 49 | , HIGHWPRICE decimal(10,0) comment '??????' |
||
| 50 | , HARDWPRICE decimal(10,0) comment '??????' |
||
| 51 | , INDSWASTETAX decimal(10,0) comment '?Y?p??' |
||
| 52 | , NOTE varchar(120) comment '???l' |
||
| 53 | , ENTRYDATE datetime comment '?o?^?N????' |
||
| 54 | , UPDATEDATE datetime comment '?X?V?N????' |
||
| 55 | , constraint billingdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,PAYMENTKIND,SEQNO,LINECOUNT) |
||
| 56 | ) comment '??????????f?[?^' ; |
||
| 57 | |||
| 58 | Insert INTO billingdatadetail |
||
| 59 | SELECT |
||
| 60 | COMPANYCODE |
||
| 61 | , TARGETDATE |
||
| 62 | , 0 |
||
| 63 | , SEQNO |
||
| 64 | , LINECOUNT |
||
| 65 | , CONSTRUCTIONCODE |
||
| 66 | , CONSTRUCTIONROWCNT |
||
| 67 | , CONSTRUCTIONCOLCNT |
||
| 68 | , FIELDNAME |
||
| 69 | , BILLPRICE |
||
| 70 | , HIGHWPRICE |
||
| 71 | , HARDWPRICE |
||
| 72 | , INDSWASTETAX |
||
| 73 | , NOTE |
||
| 74 | , ENTRYDATE |
||
| 75 | , UPDATEDATE |
||
| 76 | FROM billingdatadetail_OLD |
||
| 77 | ; |
||
| 78 | commit; |