Yes/No field in sql server table what is the same

  • what filed in sql server table is like yes/no

    in access

    so i can insert the value yes/no to table in sql server

    thnks ilan

  • I would use a BIT field (1/0).

    You can use a Varchar(3) or CHAR(3) and insert Yes / No.

    Useing a CHAR(3) will "waste" space as it'll pad the right with a space when you have a no.

    Bit is the best option.

    Cheers,

    Crispin

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • Hi midan1,

    I think the equivalent to yes/no in Access is a BIT field. You could also use a INT field. If you decide to use a BIT field don't forget to set the default value to 0 or 1. That wa a tricky pitfall when I move from Access to SQL Server

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Use the BIT datatype. SQL Server will fit up to 8 BIT fields in the space of a single byte. It handles NULL values in a separate BITMASK field, but unless you expect a "Maybe" value, it is advisable, as perviously mentioned, to set a default of zero or one.

  • Any reasons why a SQL Server BIT value of 1 is displayed in an Access db as -1 ?

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Access, I believe simply represents the FALSE boolean value (both in data storage and in VBA script) as -1. Both systems actually just look for the absense of zero, not the existence of 1 or -1. I suppose technically it could be -1, 1, or 5 for that matter since internally, it's looking to see whether the value is 0 or not 0...

    HTH,

    Jay

  • Thanks Jay,

    I thought MS handles things similar across its products

    ROTFL

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • for BIT value :

    True = 1 (in SQL Server)

    True = -1 (in Access db)

    false = 0 for the two system

    ( so when you link, Access Automatically [internally] convert 1 to -1, and when you save it the ODBC convert

    -1 to 1 .. (or it just a display convert))

    I hope this help u

    Alamir Mohamed


    Alamir Mohamed
    Alamir_mohamed@yahoo.com

  • thnks for the help

    ilan

Viewing 9 posts - 1 through 8 (of 8 total)

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