check constraint

  • hi

    my field only accept two values , 01,02 which is numeric

    i need to have check constraint ,

    my question is it should check (CHECK (Gender IN ('01','02'))

    or without quote just 01,02

  • integers,decimals, numerics and floats data types don't have preceding zeros, so no preceeding zero would be correct for those data types.

    you said numeric, but are you SURE they are numerics? '01' really implies some varchars involved.

    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!

  • You should revise the requirements, and understand them better. Because integers cant be preceded by a zero, as the guy above me said...

    Otherwise, they should not have ' ' .

  • thanks

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

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