By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,610 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,610 IT Pros & Developers. It's quick & easy.

How to change a column from a not null to null

P: n/a
Hi,

I am a bit new to db2, and I am unable to find a proper alter table
command syntax where I can remove a not null constraint on a column.
Pls help.

regards,
Baski.

Aug 10 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Baski wrote:
Hi,

I am a bit new to db2, and I am unable to find a proper alter table
command syntax where I can remove a not null constraint on a column.
Pls help.

regards,
Baski.
You could try
ALTER TABLE TABLE_NAME ALTER COLUMN COLUMN_NAME DROP NOT NULL

For other options go to
http://publib.boulder.ibm.com/infoce...c/r0000888.htm
Please note that this only works with DB2 v9. For DB2 v8 you would have to
recreate the table.

Best regards,
Kovi

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Aug 10 '07 #2

P: n/a
On Aug 10, 10:49 am, Gregor Kova <gregor.ko...@mikropis.siwrote:
Baski wrote:
Hi,
I am a bit new to db2, and I am unable to find a proper alter table
command syntax where I can remove a not null constraint on a column.
Pls help.
regards,
Baski.

You could try
ALTER TABLE TABLE_NAME ALTER COLUMN COLUMN_NAME DROP NOT NULL

For other options go tohttp://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/c...
Please note that this only works with DB2 v9. For DB2 v8 you would have to
recreate the table.

Best regards,
Kovi

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Hi Kovi, thanks for the command, it works and I am using db2 9.

Aug 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.