RE: DB2 Questions

RE: DB2 Questions

 

  

Sami,

You cannot change a column to NOT NULL after creating a table. It must
be done at the time you create a table. If you alter a table to add a
column, you can add the column with NOT NULL WITH DEFAULT.

Helen Johnson
DBA Group Lead


-----Original Message-----
From: sami dba [mailto:[Email Address Removed]
Sent: Saturday, May 31, 2003 1:05 AM
To: Yogesh Kansal
Cc: Long, Charles (euler:eti); [Email Address Removed] Helen Johnson;
Ramakumar Chalasani
Subject: Re: DB2 Questions

Hi Yohesh

Thanks for your excellent response. Could you please give me the answer
for 1st question. I mean how to set column as NOT NULL after creating a
table?

Thanks
Sami

Yogesh Kansal <[Email Address Removed] wrote:

Hi Sami ,
To increase the width of col3 from 20 30 ..
alter table test1 alter column col3 set data type varchar(30);
To add new column "col4 date" to table test1 ..
alter table test add column col4 date ;
You can't change the column name of a table ..
To set Auto-commit OFF gloabally in CLP ..
instead of running CLP by command "db2 "
start it with "db2 +c "
it will set auto commit off globally ..
Regards,
Yogesh







sami dba
, "'Helen Johnson'"
om> , Ramakumar Chalasani
,
[Email Address Removed]
05/30/2003 11:41 cc:
PM Subject: DB2 Questions






Dear All,

I'm new to db2 world, coming to oracle field.
Could anyone help me to clear my doubts/questions?

db2=>create table test1(col1 int,col2 int,col3 varchar(20);
Table Created.

Questions.
1. How to make col1 as not null column?
2. How to increase col3 width from 20 to 30?
3. How to add new column "col4 date" to table test1?
4. How to rename column "col2" to "new_col2"?
5. How to set Auto-commit OFF gloabally in CLP?


Thanks
Sami


---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).




---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).
DB2 & UDB email list listserv db2-l LazyDBA home page