--修改字段的类型
--1.字段类型兼容转换
ALTER TABLE tzxcrm.CRM_CUSCARDS ALTER COLUMN YXKSRQ VARCHAR(50)
--2.字段类型不兼容转换,通过中间字段进行字段的类型转换
ALTER TABLE tzxcrm.CRM_CUSCARDS ADD TEMP VARCHAR(50);
update tzxcrm.CRM_CUSCARDS set TEMP=YXKSRQ where YXKSRQ is not null;
alter table tzxcrm.CRM_CUSCARDS drop column YXKSRQ;
--转回来
ALTER TABLE tzxcrm.CRM_CUSCARDS ADD YXKSRQ VARCHAR(50);
update tzxcrm.CRM_CUSCARDS set YXKSRQ=TEMP where TEMP is not null;
alter table tzxcrm.CRM_CUSCARDS drop column TEMP;
reorg table tzxcrm.CRM_CUSCARDS;--重组表