Results 1 to 6 of 6

Thread: primary key....

  1. #1
    Join Date
    Sep 2006
    Posts
    105

    Unanswered: 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

  2. #2
    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

  3. #3
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    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

  4. #4
    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

  5. #5
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    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/2012
    Wim

    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

  6. #6
    Join Date
    Sep 2006
    Posts
    105
    Thanks for ur Reply.

    Thanks Rahul.It works fine.

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


    Thanks
    Meena.s

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •