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 > primary key....

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-28-06, 04:43
Meena.s Meena.s is offline
Registered User
 
Join Date: Sep 2006
Posts: 87
primary key....

Hello....

I created one table having 3 columns namely(no,name,dept).i want to make column 'no' as primary key, but it is not created with not null column.is it possible to alter a column having null into not null..........

DB2 v8.2 and o/s windows 2002.

Any help..........


Thanks
Meena.s
Reply With Quote
  #2 (permalink)  
Old 09-28-06, 05:19
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
i dont think so...
u hav to update rows having null to some value,
export,
create table with new definition,
create indexes and constraints,
import back

u have to take care that there are no duplicates for 'no'
regards,
Rahul Singh
Reply With Quote
  #3 (permalink)  
Old 09-28-06, 06:05
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 1,279
__________________
With kind regards . . . . . SQL Server 2000/2005/2008/2008 R2 Earned beers: 16
Wim
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
Reply With Quote
  #4 (permalink)  
Old 09-28-06, 06:26
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
Hey Wim,
frankly ,i avoid using altobj as very little details are available in infocenter which makes it even more difficult to understand.
i had gone through Serge article but still too hard to grasp(at least for me )
well i suppose altobj does all those steps in the background (export/create/import).
neways thanks a lot for help.

MEENA: if u want to avoid all these steps u can directly go to control center and alter table from null to not null and then create PK.

Rahul Singh
Reply With Quote
  #5 (permalink)  
Old 09-28-06, 06:33
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 1,279
Rahul,

To be honest, I too feel the same towards the documentation and use of altobj. But it could be helpfull in certain situations. It's always good to have an extra joker in your sleeve, just in case...
__________________
With kind regards . . . . . SQL Server 2000/2005/2008/2008 R2 Earned beers: 16
Wim
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
Reply With Quote
  #6 (permalink)  
Old 09-28-06, 06:45
Meena.s Meena.s is offline
Registered User
 
Join Date: Sep 2006
Posts: 87
Thanks for ur Reply.

Thanks Rahul.It works fine.

But internally it calls that system stored procedures it seems......


Thanks
Meena.s
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