Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / November 2007

Tip: Looking for answers? Try searching our database.

How can the data type be changed from BigInt to Integer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rahul Babbar - 24 Nov 2007 10:43 GMT
Hi,

What are the possible ways to change the data type of a column from
BigInt to Integer?

the normal command
Alter table <tabname> alter column <colname> set data type Integer
gives the error
SQL0190N  ALTER TABLE <table> specified attributes for column "VALUE"
that are not compatible with the existing column.  SQLSTATE=42837

Why is it failing, when i have only 2 records in the table which are
less than the value that Integer will take.

What could be other possible ways of changing the data type?
Dropping and recreating the column could be an option but the data
might be lost in such a case..

Also, what considerations need to be taken (while altering the data
type or while dropping it and recreating it) if there are indexes
existing on that column.

Thanks a lot.

Rahul Babbar
Serge Rielau - 24 Nov 2007 15:39 GMT
> What are the possible ways to change the data type of a column from
> BigInt to Integer?
Check the alter table wizard in DeveloperWorkbench. It supports downcasting.
The DB2 for LUW server side ALTER TABLE statement today supports only
"safe" casts. That is casts from a smaller to a bigger type.
Extending this is a known requirement which is being looked at for a
future release.

Serge

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.