Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    8

    Unanswered: Alter column without deleting it first

    I have a table which already contains data and i want to change the allow null attribute. Is there a way to change this without fdropping the column first, because then i wouldn't lose existing data.

    Thanks in advance.

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Null, you said?
    Code:
    Akon_> create table brisime (a number not null);
    
    Table created.
    
    Akon_> insert into brisime values (1);
    
    1 row created.
    
    Akon_> alter table brisime modify a null;
    
    Table altered.
    
    Akon_> 
    alter table brisime modify a not null;
    
    Table altered.
    
    Akon_>
    If I understood your problem well, as you can see - there's no need for you to do anything with that column.

    You would have to do something if you wanted to change columns datatype or decrease its size, for example. But, you didn't want to

  3. #3
    Join Date
    Mar 2004
    Posts
    8

    Thanks

    Thats exactly what i needed.

Posting Permissions

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