是否可以在Firebird数据库中将varchar(32)的字段转换为BLOB

fin*_*ist 3 sql firebird utf-8

我想将已保存的数据保存到表字段varchar(32)中,并将其转换为Firebird数据库中的BLOB.我正在使用一个软件:IBExpert ....如果有可能,该怎么做?

小智 7

让我们考虑你有一个表TEST有一列NAME:

create table test (name varchar(32));
insert into test values('test1');
insert into test values('test2');
insert into test values('test3');
commit;
select * from test;
Run Code Online (Sandbox Code Playgroud)

可以通过以下脚本将列从varchar更改为BLOB:

alter table test add name_blob blob;
update test set name_blob = name;
commit;
alter table test drop name;
alter table test alter column name_blob to name;
commit;
select * from test;
Run Code Online (Sandbox Code Playgroud)