468,119 Members | 1,981 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,119 developers. It's quick & easy.

Altering the type of a VARCHAR column to be VARCHAR FOR BIT DATA

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

May 28 '07 #1
1 3305
RGow wrote:
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.
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

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 28 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Dave Serrano | last post: by
12 posts views Thread by Prabu Subroto | last post: by
5 posts views Thread by rAinDeEr | last post: by
9 posts views Thread by JimmyKoolPantz | last post: by
5 posts views Thread by WombatDeath | last post: by
13 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.