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 > Alter Table Syntax

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-05, 12:24
dseifried dseifried is offline
Registered User
 
Join Date: Sep 2002
Posts: 11
Alter Table Syntax

I don't think this is possbile but I thought I would check. Is it possible to Alter a column from Nullable to Not Nullable w/o dropping and recreating the table? I'm coming a SQL Server background and there you can do the following....

ALTER TABLE TABLENAME ALTER COLUMN CNAME NOT NULL

As long as there are no values currently null in the table, this will work and is much faster than the alternative. Is there something that is similar or easier in DB2.

Thanks
Reply With Quote
  #2 (permalink)  
Old 01-31-05, 16:43
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
This kind of alteration is not possible in DB2 as far as I understand. Depending on why you need this you can add a check constraint:

ALTER TABLE TABLENAME ADD CONSTRAINT T1C1 CHECK (CNAME IS NOT NULL)
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