Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to alter a column to make it NOT NULL?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to alter a column to make it NOT NULL?
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    Post subject: Re: How to alter a column to make it NOT NULL?
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us