sql changes the table type and comments of one column or all columns

a row

ALTER TABLE cspg_mp_db.mp_device_electric_consumption_statistics_1d MODIFY COLUMN electric double(20,2) NULL COMMENT '电量';

all columns

SELECT CONCAT('ALTER TABLE wangguan MODIFY ',
              COLUMN_NAME, ' FLOAT(10,3);')
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'wangguan';

Guess you like

Origin blog.csdn.net/weixin_42835230/article/details/131728097