467,154 Members | 665 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,154 developers. It's quick & easy.

How to change a column from a not null to null

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
  • viewed: 43336
Share:
2 Replies
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
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.

Similar topics

2 posts views Thread by Mick White | last post: by
1 post views Thread by Jerry Collings | last post: by
5 posts views Thread by Robert Stearns | last post: by
3 posts views Thread by travlintom@yahoo.com | last post: by
6 posts views Thread by axelsino@gmail.com | last post: by
5 posts views Thread by John | last post: by
2 posts views Thread by siujean@gmail.com | last post: by
2 posts views Thread by Jeff Kish | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.