IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to alter a column to make it NOT NULL?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Avinash_Gupta

New User


Joined: 11 May 2005
Posts: 26
Location: Hyderabad

PostPosted: Sat Feb 11, 2006 12:45 am
Reply with quote

Hi,

I have a DB2 table in which all columns are declared NOT NULL.I had to add two more columns in the table later.I added the columns using ALTER command but i forgot to add the not null constraint.

Is there any way which can help me in making the modification so that the last two colums added by me become NOT NULL.

Please let me know if there is a solution to it.

Regards
Back to top
View user's profile Send private message
ragshere

New User


Joined: 20 Dec 2004
Posts: 70

PostPosted: Sat Feb 11, 2006 3:19 pm
Reply with quote

Hi avinash,
You need to drop and recreate the table by adding NULL parameters.

There is no other option. Before dropping the table, take a unload of data.


Thanks
Rags
Back to top
View user's profile Send private message
ANIKET

New User


Joined: 28 Apr 2005
Posts: 11
Location: PUNE

PostPosted: Mon Feb 13, 2006 12:39 pm
Reply with quote

Ragshere,
I think creating unique index on those two column will do the work. Try it.
Back to top
View user's profile Send private message
ANIKET

New User


Joined: 28 Apr 2005
Posts: 11
Location: PUNE

PostPosted: Mon Feb 13, 2006 1:10 pm
Reply with quote

Please ignore my previous comment. Ragshere is right. You have to drop the table and recreate it with all the parameters you want.


Creating Unique index on new two columns will restrict any null value as well any duplicate data value. And I think you don?t want second criteria. So recreating table is the only remaining option.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts DROP & ALTER PARTITION-PBR DB2 0
No new posts trying to make sense of keylists TSO/ISPF 11
Search our Forums:

Back to Top