Hi,
I'd like to know whether there is a way to alter the data type of a
VARCHAR FOR BIT DATA column to be simply a VARCHAR column? I executed
an ALTER TABLE statement, similar to,
ALTER TABLE tab_name ALTER COLUMN col_name SET DATA TYPE VARCHAR(100)
without any problems. However, a simple Java application reports via
JDBC that the column type is still VARCHAR FOR BIT DATA.
Secondly, how would I perform the opposite operation i.e. alter the
data type of a VARCHAR column to be VARCHAR FOR BIT DATA? A statement
such as the following fails:
ALTER TABLE tab_name ALTER COLUMN col_name SET DATA TYPE VARCHAR(100)
FOR BIT DATA
Please note that I'm looking for a solution that will be compatible
with DB2 v8 and v9.
Regards,
Ryan
Serge Rielau - 28 May 2007 14:34 GMT
> Hi,
>
[quoted text clipped - 16 lines]
> Please note that I'm looking for a solution that will be compatible
> with DB2 v8 and v9.
If you want a DB2 V8.2 solution then I don't think there is a way around
unload an reload of the data. You can use the ALTOBJ() procedure or the
ALTER TABLE wizard in the control center to instrument the process.
Have you considered a view? A simple CAST(c1 AS VARCHAR(100) FOR SBCS
DATA) is all you need.
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab