473,394 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
2 47952
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mick White | last post by:
I inadvertantly named a field "in" mysql> select * from guestbook; +----+-------+-------+-----------------+----------------+ | id | fname | lname | comments | in |...
1
by: Jerry Collings | last post by:
I'm getting improperly nested xml when a column contains null. I modified the first row (customer ALFKI) to have a NULL Address column. I'm using the following XSD Annotated Schema against the...
5
by: Robert Stearns | last post by:
Either I missed something, or ALTER TABLE does not have this capability. Is there any way of doing it except DROPping all constraints which mention this table, EXPORTing the data, DROPping the...
3
by: travlintom | last post by:
Hi all. I have a datagrid that has several columns including the Primary Key as the first column. When I add records to the grid the Primary Key column show "Null". This would not be a...
6
by: axelsino | last post by:
I know this has been asked before and yes, I have read the section in the documentation about it. But, my question is: If I have setup mysql with strict_trans_tables, will MySQL allow "null"...
5
by: John | last post by:
I just cannot manage to perform a SELECT query with NULL parameter... My CATEGORY table does have one row where TCATEGORYPARENTID is null (real DB null value). TCATEGORYID and TCATEGORYPARENTID...
2
by: siujean | last post by:
As captioned question, i would like to how to alter the column from null to not null? Thanks
2
by: Jeff Kish | last post by:
Hi. I've read up on this, and have something that works, but I was wondering if there is anything I'm overlooking with this. Situation is: I have a bunch of tables.. I need to modify table2...
1
by: olgagjor | last post by:
how can i change column in gridview with css in visual studio 2005. my table has 5 rows and 4 columns.if i want to change 3 rd column can i change entire column or i must change separately. because i...
9
by: craigbert | last post by:
Hello All, I am having problems finding the correct syntax for changing a column from NULL to NOT NULL. We are using DB2 on z/OS. I have tried: ALTER TABLE TEST_CB ALTER COLUMN TEST_CHAR...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.