Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2012

    Unanswered: add a new column to a table with conditions

    hi friends
    i want to add a column to a table with conditions below :
    1- it has a default value=0
    2- this column can get null value
    3- no constraint should be created

    is it possible ?

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    The short answer is yes, it can be created. The process depends on what version of SQL Server you are using, and may be influenced by the reasoning behind point #3.

    Give us some more information about your problem. It can definitely be solved, but the devil is in the details!

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jun 2003
    Provided Answers: 1
    Quote Originally Posted by pooya1072 View Post
    3- no constraint should be created
    A default is a constraint.
    There is no reason to avoid using constraints. Why would you not be able to implement one in this scenario?
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

  4. #4
    Join Date
    May 2013
    execute this cod
    alter (your table) add ( the colum) and execute it

Posting Permissions

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