-- 工事資材情報 DROP TABLE IF EXISTS constructionmaterialinfo_OLD; CREATE TABLE constructionmaterialinfo_OLD As Select * from constructionmaterialinfo ; drop table if exists constructionmaterialinfo cascade; create table constructionmaterialinfo ( CONSTRUCTIONCODE int(10) unsigned default 0 not null comment '工事番号' , MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード' , PROCESSDATE datetime comment '処理年月日' , RENTCOUNT smallint(5) unsigned comment '貸出数' , REPAYCOUNT smallint(5) unsigned comment '返却数' , JUNKCOUNT smallint(5) unsigned comment '破棄数' , COMPLETEFLG tinyint(3) unsigned comment '完了フラグ' , ENTRYDATE datetime comment '登録日付' , UPDATEDATE datetime comment '更新日付' , constraint constructionmaterialinfo_PKC primary key (CONSTRUCTIONCODE,MATERIALITEMCODE,PROCESSDATE) ) comment '工事資材情報' ; Insert INTO constructionmaterialinfo SELECT CONSTRUCTIONCODE , MATERIALITEMCODE , DATE(ENTRYDATE) , RENTCOUNT , REPAYCOUNT , 0 , COMPLETEFLG , ENTRYDATE , UPDATEDATE FROM constructionmaterialinfo_OLD ; commit;