---
title: "5.4、单选改多选"
docId: "302236096450789376"
source: "https://weapp.eteams.cn/build/techdoc/wdoc/index.html#/public/repository/9c2e5f92-03b4-4207-9b22-a0c1dd79ac56/doc/302236096450789376"
---
Mysql示例：

update form_field set single = 0,other_properties = replace(other_properties,'"isSingle":true','"isSingle":false') where id = 字段ID;

update form_table_field set type_len = 16,column_type = 'TEXT' where field_id = 字段ID;

alter table 表名 change 字段名 字段名 text;

 

PG示例：

update form_field set single = false,other_properties = replace(other_properties,'"isSingle":true','"isSingle":false') where id = 字段ID;

update form_table_field set type_len = 16,column_type = 'TEXT' where field_id = 字段ID;

alter table 表名 alter column 字段名 type text;

-- 第三个sql不同数据库差异比较大：

-- sqlserver：

update form_field set single = 0,other_properties = replace(other_properties,'"isSingle":true','"isSingle":false') where id = 1003569003545665536;

update form_table_field set type_len = 16,column_type = 'TEXT' where field_id = 1003569003545665536;

alter table ft_zzlcbd_ws  alter column xgryxx text;

-- 达梦/神通：

update form_field set single = 0,other_properties = replace(other_properties,'"isSingle":true','"isSingle":false') where id = 1003569003545665536;

update form_table_field set type_len = 16,column_type = 'TEXT' where field_id = 1003569003545665536;

alter table ft_zzlcbd_ws modify xgryxx text;

-- oracle：

update form_field set single = 0,other_properties = replace(other_properties,'"isSingle":true','"isSingle":false') where id = 1003569003545665536;

update form_table_field set type_len = 16,column_type = 'TEXT' where field_id = 1003569003545665536;

alter table ws_test1 add xgryxx_tmp clob;

update ws_test1 set xgryxx_tmp = xgryxx;

-- 执行下面的这一步之前最好可以检查下字段数据是否已经迁移到新字段中

alter table ws_test1 drop column xgryxx;

alter table ws_test1 rename column xgryxx_tmp to xgryxx;
