Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us