Subject RE: [firebird-support] Changing field size to smaller
Author Riho-Rene Ellermaa
I use this script (DETAILS was varchar(210)):

ALTER TABLE corresp add TEMP Varchar(140) CHARACTER SET WIN1252 COLLATE
WIN1252;
update corresp set temp=details;
ALTER TABLE corresp drop details;
ALTER TABLE corresp add details Varchar(140) CHARACTER SET WIN1252
COLLATE WIN1252;
update corresp set details=TEMP;
ALTER TABLE corresp drop TEMP;

I can't move the data! Script causes "arithmetic or string truncation
error" when old Details field data is longer than 140

Riho Ellermaa

> -----Original Message-----
> From: Martijn Tonies [mailto:m.tonies@...]
> Sent: Tuesday, August 10, 2004 1:58 PM
> To: firebird-support@yahoogroups.com
> Subject: Re: [firebird-support] Changing field size to smaller
>
> Hi,
>
> > I want to write SQL script for database modification.
> > Can someone tell me is it possible to change existing varchar(200)
> > field into varchar(150) when the table contains data longer
> than 150 symbols.
> > Currently I get truncation error when trying to update data from
> > longer field to shorter.
>
> The only way to do this is to create a new column, move the
> data and drop the old column.
>
> With regards,
>