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 / March 2006

Tip: Looking for answers? Try searching our database.

Alter Column

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kimi - 31 Mar 2006 12:54 GMT
Hi,

I'm trying to change a column on a DB2 table so that it has a default value
but I cannot get it to work. Does anyone have any experience in this area.

I'm trying with this statement:

Alter Table x
           Alter column y default 0;

I also tried with this:

Alter Table x
           Alter Column y Set Data Type SmallInt With Default 0;

And this:

Alter Table x
           Alter Column y Set Default 0;

I simply cannot make it work ;o(

Thanks in advance

Kimi
Serge Rielau - 31 Mar 2006 13:01 GMT
> Hi,
>
[quoted text clipped - 17 lines]
>
> I simply cannot make it work ;o(
Which versiuon are you on?
DB2 V8.2 for LUW introduced altering of the default.
The syntax is described in the online books and in the latest (FP7)
local doc download.

Cheers
Serge
Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Kimi - 31 Mar 2006 13:55 GMT
It's DB2 V8.1 on z/OS ... as for the guides, I have a hard time
understanding what they're trying to describe ...

Thanks

Kimi

>> Hi,
>>
[quoted text clipped - 25 lines]
> Cheers
> Serge
Serge Rielau - 31 Mar 2006 14:36 GMT
> It's DB2 V8.1 on z/OS ... as for the guides, I have a hard time
> understanding what they're trying to describe ...
Well, the syntax would be:
ALTER TABLE <tablename> ALTER COLUMN <columnname>
and then syntax to set/add or alter the default, but all you can do is
SET GENERATED [ALWAYS|DEFAULT].
Seems like you're out of luck w.r.t. to the straight approach.

Cheers
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



©2008 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.