Need To store true or False

  • I have a column name status in mytable. It should have either true or false

    as a data.

    for storing true or false value which data types is preferable...

  • personally i use an integer with a check constraint limiting values to 0 and 1;you could use a BIT data type,but I like an integer to anticipate those situations where the flag starts turning into a status..

    For example a (SHIPPEDFLAG) columns needs to change, so instead of TRUE/FALSE, suddenly needs 'tween statuses like RECEIVED/INVOICED/PROCESSING/PACKAGED/SHIPPED, and in that case it makes it a little easier to support the switch...just changing the constraint, or making it suddenly reference a new table with matching values for the foreign keys.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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