Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Virginia
    Posts
    11

    Question Unanswered: ? on Check Constraint expressions

    I am creating a check constraint on a field (GRID_NBR) for values between 1 & 99. I am a little confused on creating the expression for it (Books online is vague).

    Can I use the following expression: GRID_NBR BETWEEN 1 AND 99

    Or do I have to use: GRID_NBR > 0 AND GRID_NBR < 100


    Thanks!

  2. #2
    Join Date
    Mar 2004
    Location
    Virginia
    Posts
    11

    Thumbs up

    Quote Originally Posted by mrallgood
    I am creating a check constraint on a field (GRID_NBR) for values between 1 & 99. I am a little confused on creating the expression for it (Books online is vague).

    Can I use the following expression: GRID_NBR BETWEEN 1 AND 99

    Or do I have to use: GRID_NBR > 0 AND GRID_NBR < 100


    Thanks!
    I found my own answer (in Books Online)....here's the example it gave on the Constraint page...

    CREATE TABLE cust_sample
    (
    cust_id int PRIMARY KEY,
    cust_name char(50),
    cust_address char(50),
    cust_credit_limit money,
    CONSTRAINT chk_id CHECK (cust_id BETWEEN 0 and 10000 )
    )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •