其他分享
首页 > 其他分享> > prod 改表字段

prod 改表字段

作者:互联网


# 原本
ALTER TABLE test_staging2_prp3.PROLCLAIMOPINION_V3 DROP COLUMN accidentdate; -- 
ALTER TABLE test_staging2_prp3.PROLCLAIMOPINION_V3 ADD COLUMN accidentdate DATE  COMMENT '出险日期'  AFTER claimdate;

 

# 现在
# 第 1 步
rename table PROLCLAIMOPINION_V3 to PROLCLAIMOPINION_V32;

 

# 第 2 步
CREATE TABLE `prolclaimopinion_v3` (
  `transactionno` varchar(50) NOT NULL COMMENT '交易编码',
  `companycode` varchar(15) NOT NULL COMMENT '公司编码',
  `policyno` varchar(50) NOT NULL COMMENT '保单编号',
  `registno` varchar(50) NOT NULL COMMENT '报案编号',
  `clmno` varchar(50) NOT NULL COMMENT '立案编号',
  `lev_catacode` varchar(10) DEFAULT NULL COMMENT '巨灾代码',
  `lev_cataname` varchar(255) DEFAULT NULL COMMENT '巨灾名称',
  `operatorcode` varchar(50) NOT NULL COMMENT '立案人编号',
  `operatorname` varchar(500) NOT NULL COMMENT '立案人姓名',
  `opinions` varchar(4000) NOT NULL COMMENT '立案意见',
  `claimdate` datetime NOT NULL COMMENT '立案时间',
  `accidentdate` date DEFAULT NULL COMMENT '出险日期',
  `accidenttime` datetime NOT NULL COMMENT '出险时间',
  `chdamagecode` varchar(10) DEFAULT NULL COMMENT '财产险出险原因代码',
  `rsdamagecode` varchar(10) DEFAULT NULL COMMENT '人身险出险原因分类代码',
  `damagename` varchar(255) NOT NULL COMMENT '出险原因名称',
  `accidentdesc` varchar(4000) DEFAULT NULL COMMENT '出险过程描述',
  `damageaddresstypecode` varchar(10) DEFAULT NULL COMMENT '出险地区代码',
  `accidentsite` varchar(255) DEFAULT NULL COMMENT '出险地点',
  `estimatedlossamountorigcur` varchar(10) NOT NULL COMMENT '预估损失金额原币币别代码',
  `estimatedlossamountorig` decimal(18,4) NOT NULL COMMENT '预估损失金额原币金额',
  `estimatedlossamount` decimal(18,4) NOT NULL COMMENT '预估损失金额',
  `lawsuitflag` varchar(10) DEFAULT NULL COMMENT '诉讼案件标志',
  `claimdealcode` varchar(50) NOT NULL COMMENT '立案处理机构名称',
  `claimdealname` varchar(255) NOT NULL COMMENT '立案处理机构名称',
  `casereopenflag` varchar(10) DEFAULT NULL COMMENT '重开案标志',
  `casereopentime` datetime DEFAULT NULL COMMENT '按键重开时间',
  `casereopennum` int(11) DEFAULT NULL COMMENT '案件重开次数',
  `clmnoorig` varchar(50) DEFAULT NULL COMMENT '原立案编号',
  `transactiondate` datetime NOT NULL COMMENT '交易完成时间',
  `batchno` varchar(50) NOT NULL COMMENT '批次号',
  `ds_batch_no` char(17) NOT NULL COMMENT 'Data Submission通用批次号',
  PRIMARY KEY (`transactionno`,`policyno`,`registno`,`clmno`,`batchno`) USING BTREE,
  KEY `ds_batch_no` (`ds_batch_no`) USING BTREE,
  KEY `TransactionNo` (`transactionno`) USING BTREE,
  KEY `ClaimDate` (`claimdate`) USING BTREE,
  KEY `CaseReopenTime` (`casereopentime`) USING BTREE,
  KEY `CaseReopenNum` (`casereopennum`) USING BTREE,
  KEY `ClmNoOrig` (`clmnoorig`) USING BTREE,
  KEY `CompanyCode` (`companycode`) USING BTREE,
  KEY `TransactionDate` (`transactiondate`) USING BTREE,
  KEY `PolicyNo` (`policyno`) USING BTREE,
  KEY `ClmNo` (`clmno`) USING BTREE,
  KEY `RegistNo` (`registno`) USING BTREE,
  KEY `OperatorCode` (`operatorcode`) USING BTREE,
  KEY `OperatorName` (`operatorname`) USING BTREE,
  KEY `Opinions` (`opinions`(768)) USING BTREE,
  KEY `AccIdentTime` (`accidenttime`) USING BTREE,
  KEY `DamageName` (`damagename`) USING BTREE,
  KEY `ClaimDealCode` (`claimdealcode`) USING BTREE,
  KEY `ClaimDealName` (`claimdealname`) USING BTREE,
  KEY `BatchNo` (`batchno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='理赔立案信息表'

 

 

 

# 第 3 步
INSERT INTO `prolclaimopinion_v3` (`transactionno`, `companycode`, `policyno`, `registno`, `clmno`, `lev_catacode`, `lev_cataname`, `operatorcode`, `operatorname`, `opinions`, `claimdate`, `accidentdate`, `accidenttime`, `chdamagecode`, `rsdamagecode`, `damagename`, `accidentdesc`, `damageaddresstypecode`, 
`accidentsite`, `estimatedlossamountorigcur`, `estimatedlossamountorig`, `estimatedlossamount`, `lawsuitflag`, `claimdealcode`, `claimdealname`, `casereopenflag`, `casereopentime`, `casereopennum`, `clmnoorig`, `transactiondate`, `batchno`, `ds_batch_no`) SELECT `transactionno`, `companycode`, `policyno`, `registno`, `clmno`, `lev_catacode`, `lev_cataname`, `operatorcode`, `operatorname`, `opinions`, `claimdate`, `accidentdate`, `accidenttime`, `chdamagecode`, `rsdamagecode`, `damagename`, `accidentdesc`, `damageaddresstypecode`,
`accidentsite`, `estimatedlossamountorigcur`, `estimatedlossamountorig`, `estimatedlossamount`, `lawsuitflag`, `claimdealcode`, `claimdealname`, `casereopenflag`, `casereopentime`, `casereopennum`, `clmnoorig`, `transactiondate`, `batchno`, `ds_batch_no` FROM prolclaimopinion_v32;

 

标签:COMMENT,NULL,varchar,表字,KEY,USING,prod,BTREE
来源: https://www.cnblogs.com/xiluhua/p/15657471.html