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) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

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