SQLBase varchar col到long varchar col

时间:2015-03-26 09:41:45

标签: sql sqlbase

我有一个SQLBase-Database,我必须将VARCHAR列修改为LONG VARCHAR列。

由于无法在sqlbase中修改数据类型,我想创建临时列,将数据从varchar列切换到临时列,删除varchar列并重命名临时列。

以下是我的SQL语句:

ALTER TABLE NetworkShares ADD TEMP LONG VARCHAR;
UPDATE NetworkShares SET TEMP = Passwort;
ALTER TABLE NetworkShares DROP Passwort;
ALTER TABLE NetworkShares RENAME TEMP Passwort;

但是使用我的代码我得到了这个错误消息:

Error: 01602 TYP MBB Long must be set to bind variable

我有什么想法可以解决我的问题?

1 个答案:

答案 0 :(得分:1)

create table TMP_NetworkShares(
    <define all columns here as per NetworkShares>,
    PASSWORT long varchar not null
) pctfree 10;

insert into TMP_NetworkShares(
    <define all columns here as per NetworkShares>,
    PASSWORT ) select
    <define all columns here as per NetworkShares>,
    PASSWORT
        from NetworkShares;

drop table NetworkShares;

alter table TMP_NetworkShares rename table NetworkShares;

grant all on NetworkShares to PUBLIC;