Bambuk
Bambuk

Reputation: 182

SQLBase varchar col to long varchar col

I have a SQLBase-Database where I have to modify a VARCHAR column to a LONG VARCHAR column.

As it is not possible to modfiy a datatype in sqlbase I want to create a temp column, switch the data from the varchar column to the temp column, delete the varchar column and rename the temp column.

Here are my SQLStatements:

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

But with my code I get this errormessage:

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

Any ideas how I can solve my problem ?

Upvotes: 0

Views: 597

Answers (1)

Steve Leighton
Steve Leighton

Reputation: 840

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;

Upvotes: 1

Related Questions