Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Alter Null Column to not null with default value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1025
Location: Bangalore,India

PostPosted: Thu Oct 09, 2008 5:20 pm    Post subject: Alter Null Column to not null with default value
Reply with quote

Hi All,

I want to alter nullable column to not null with default .
I have a table employee it contain some col

Emp-Depart char(16) ;

want to change it to
Emp-Depart char(16) not null with default 'training';

One way it to add constraint
ALTER TABLE <TABLENAME> ADD CONSTRAINT NULL_FIELD CHECK (<FIELD> IS NOT
NULL)

But it will not contain default value...

Please advise.
Back to top
View user's profile Send private message
References
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1025
Location: Bangalore,India

PostPosted: Thu Oct 09, 2008 6:45 pm    Post subject:
Reply with quote

Hello All,

Just to add that we are using db2v8.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1