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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Make job wait until submitted job is ... JCL & VSAM 4
No new posts Extract ISPF table column headings CLIST & REXX 2
No new posts how to eliminate null indicator value... DB2 7
No new posts ISPF Table to add a new column TSO/ISPF 1
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
Search our Forums:


Back to Top