Subject Re: [IBO] IBOGrid and varchar problem
Author Helen Borrie
At 12:03 PM 21/01/2005 +0000, you wrote:


>It doesn't seem to be related to the varchar, rather the size of the
>column. Column VAL was varchar(10000), I changed to char(10000) - same
>problem.

Um...you will have difficulty displaying a char(10000), since char(10000)
is 10000 bytes. Use a blob sub_type 1 to store strings this large and -
take my STRONG advice - *never* define a char(10000).


>(As an alternative: does anyone know a way to convert a varchar(10000)
>column into a char(200) column via sql? simply altering the data type
>via ALTER TABLE doesn't do the job).

In SQL you can't change a varchar to a char or varchar that is smaller than
the length of the largest string stored. You can't change a char to a
smaller size *at all*. And you should NOT be trying to create a
char(200). Use chars only for SHORT strings that have a set format, e.g. a
social security number, telephone number or a barcode of fixed length.

If you want to reduce your varchar(10000) to a varchar(200), bear in mind
that you will lose data. If you are happy about that, then do as follows:

1. Take a backup of the database and store it somewhere safe

2. Update the entire table like this:

UPDATE ATABLE
SET YOUR_VARCHAR_COL = SUBSTRING(YOUR_VARCHAR_COL FROM 1 FOR 200);

COMMIT;

3. ALTER TABLE ATABLE
ALTER COLUMN YOUR_VARCHAR_COL
TYPE VARCHAR(200);
COMMIT;


>Here is the dfm of a sample app:

Nothing useful in there: you have no properties set for the column
objects. Anyway, you seem to have some confusion about the use of varchar
vs char. Normally, keep the defaults for FieldsTrimming with varchars and
set FieldsTrimming=N for chars. Just avoid those long char(n) definitions!!

Helen