If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > removing not null constraint in db2.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-24-04, 06:31
shrinibv1 shrinibv1 is offline
Registered User
 
Join Date: Feb 2004
Posts: 7
removing not null constraint in db2.

is it possibel to delete the not null constraint in the db2? Please reply back immediately as this is urgent for us.

Regards
Shrini
Reply With Quote
  #2 (permalink)  
Old 02-24-04, 06:51
Walter Janissen Walter Janissen is offline
Registered User
 
Join Date: Nov 2003
Location: Germany
Posts: 62
In DB2 z/OS: no if you talk about a column defined as NOT NULL. If you ensure it through a table constraint, then you can drop that constraint.
Reply With Quote
  #3 (permalink)  
Old 02-24-04, 06:58
shrinibv1 shrinibv1 is offline
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks Walter
Dropping the table level constraint is possible. but any idea why the dropping the column level setting can't be rubbed off?

Regards
Shrini
Reply With Quote
  #4 (permalink)  
Old 02-24-04, 07:05
Walter Janissen Walter Janissen is offline
Registered User
 
Join Date: Nov 2003
Location: Germany
Posts: 62
Hi

I don't know, if my reply was clear. If you create your table as
CREATE TABLE T1 ... COL1 SMALLINT NOT NULL, then you cannot change the null constraint, because DB2 does not offer this feature.

If you create your table with CREATE TABLE T1 ... COL1 SMALLINT CHECK (COL1 IS NOT NULL) then you can drop this check constraint, by using ALTER TABLE T1 DROP constraintname.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On