You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by LeiLi <le...@hotmail.com> on 2009/05/15 20:42:24 UTC

How to check existing column size?

Hello,

I'm trying to insert data into a column named "HISTORY" ,but it complained
that :

ERROR 22001: A truncation error was encountered trying to shrink VARCHAR
'xxxxxxxx' to length 20.

then I tried to alter the column size to longer :
alter table myTABLE alter HISTORY set DATA TYPE varchar(40);
but it complained:
ERROR 42Z17: Invalid length specified for column 'HISTORY'. Length must be
greater than the current column length.

it seems that first it said the length is 20 ,then it's larger than 40?
so how can I know what's the current size of the column "HISTORY" and how
can I make it work?

Thanks a lot.

Lei

-- 
View this message in context: http://www.nabble.com/How-to-check-existing-column-size--tp23565303p23565303.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: How to check existing column size?

Posted by LeiLi <le...@hotmail.com>.
Thank you, describe is just what I want. the rest two I'll remember, they
will be handy when I need them.

Lei


Bryan Pendleton wrote:
> 
>> so how can I know what's the current size of the column "HISTORY" and how
> 
> In ij, you can say 'describe mytable', and it will print a nice display.
> 
> Alternatively, you can say
> 
>     select * from sys.syscolumns where columnname='HISTORY'
> 
> Yet a 3rd way would be to call DatabaseMetaData.getColumns().
> 
> For simple interactive use, the 'describe' command should be the easiest.
> 
> thanks,
> 
> bryan
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-check-existing-column-size--tp23565303p23569304.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: How to check existing column size?

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> so how can I know what's the current size of the column "HISTORY" and how

In ij, you can say 'describe mytable', and it will print a nice display.

Alternatively, you can say

    select * from sys.syscolumns where columnname='HISTORY'

Yet a 3rd way would be to call DatabaseMetaData.getColumns().

For simple interactive use, the 'describe' command should be the easiest.

thanks,

bryan