adding default column with type BIT and default value as Y

  • I want to add new column test to the table contact with type BIT with default value Y. PLease let me know how to do this

  • What have you tried so far? Have you had a look at the ALTER TABLE syntax? There are loads of examples in the documentation, why didn't your attempt work?

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Bit data type is numeric in SQL: naturally 1 means Yes, 0 means No.

    So:

    CREATE TABLE dbo.table_name ( bit_column bit DEFAULT 1 );

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply