Subject Re: [firebird-support] Changing field size to smaller
Author Ivan Prenosil
You must explicitely trim the data
update corresp set temp=substring(details from 1 for 140);


Or you can change the size by updating system tables
(first you have to ensure there are not any data longer than new size).

Or you can leave the table as is - thanks to compression of rows,
data in new table structure will occupy the same space anyway.

Ivan

----- Original Message -----
From: "Riho-Rene Ellermaa" <r.ellermaa@...>
To: <firebird-support@yahoogroups.com>
Sent: Tuesday, August 10, 2004 1:59 PM
Subject: RE: [firebird-support] Changing field size to smaller


> 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