Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Posts
    15

    Unanswered: adding a not null column

    Hi,

    Is it possible to add a not null column to an existing table.

    I am able to add only a nullable column using the below command:
    alter table EMPLOYEE
    add DATE_OF_RETURN datetime null
    go

    Thanks & Rgds,
    Sankar

  2. #2
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443
    You require a default clause when you are adding a not null column so that ASE can fill the existing rows with the default value.

  3. #3
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443
    If you do not want to specify a "default" clause, you can

    a) bcp out the data from original table
    b) create a new table with the correct datastructure
    c) bcp in the data to the new table
    d) Rename the new table

    You can also use SELECT instead of bcp

  4. #4
    Join Date
    Feb 2003
    Posts
    15
    Thanks for the replies.

    I came to know that the not null columns can be added using default clause in Sybase 12.* but that does not work in Sybase 11.9.2

    Thanks,
    Sankar

Posting Permissions

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