SQLServer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • squrel
    New Member
    • Jan 2008
    • 143

    SQLServer

    Hi..
    I have a Table in Sqlserver 2000 called Table1 and have created a new column in that table called column1 with default value Null and i want to replace that value to D by default...
    Can anyone help me with the syntax..
    Thank u in advance
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    The following is the complete syntax to alter the table.


    ALTER TABLE [ database_name . [ schema_name ] . | schema_name . ] table_name
    {
    ALTER COLUMN column_name
    {
    [ type_schema_nam e. ] type_name [ ( { precision [ , scale ]
    | max | xml_schema_coll ection } ) ]
    [ COLLATE collation_name ]
    [ NULL | NOT NULL ]
    | {ADD | DROP } { ROWGUIDCOL | PERSISTED | NOT FOR REPLICATION}
    }
    | [ WITH { CHECK | NOCHECK } ] ADD
    {
    <column_definit ion>
    | <computed_colum n_definition>
    | <table_constrai nt>
    } [ ,...n ]
    | DROP
    {
    [ CONSTRAINT ] constraint_name
    [ WITH ( <drop_clustered _constraint_opt ion> [ ,...n ] ) ]
    | COLUMN column_name
    } [ ,...n ]
    | [ WITH { CHECK | NOCHECK } ] { CHECK | NOCHECK } CONSTRAINT
    { ALL | constraint_name [ ,...n ] }
    | { ENABLE | DISABLE } TRIGGER
    { ALL | trigger_name [ ,...n ] }
    | SWITCH [ PARTITION source_partitio n_number_expres sion ]
    TO target_table
    [ PARTITION target_partitio n_number_expres sion ]
    }
    [ ; ]

    Comment

    Working...