Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Montreal, Canada
    Posts
    44

    Unanswered: Alter Column Set Default

    I've done some research on setting the default value of a column and found the following code:

    ALTER TABLE [table1] ALTER COLUMN [column1] SET DEFAULT 0

    I am trying to set column1 within table1 to a default value of 0, column1 is an int data type. But it doesn't work within MS SQL SERVER 2000.

    Can anyone tell me what's wrong?

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    what you want is this:

    ALTER TABLE table1
    ADD CONSTRAINT DF_table1_column1
    DEFAULT 0 FOR column1

  3. #3
    Join Date
    Dec 2002
    Location
    Montreal, Canada
    Posts
    44
    Thanks very much! It's appreciated.

Posting Permissions

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