Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    KL, Malaysia
    Posts
    38

    Red face Unanswered: Check Constraint Regular Expressions

    Does MS SQL support full blown Regular expression features under SQL CHECK CONTRAINTS ?
    Save the dugongs!

  2. #2
    Join Date
    Dec 2002
    Location
    Czech Republic
    Posts
    249
    Full blown Regular expression features? Explain what it is!

  3. #3
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Yes to an extent. Remeber that a check constraint need only evaluate to True Or False. Consider the following:

    Code:
    create table #Tmp(f1 int, f2 varchar(10) constraint Tmp_f2 check(f2 like 'a_[0-9][0-9]-[A-Z]'))
    insert into #tmp values (1,'az00-a')
    insert into #tmp values (1,'a*99-a')
    insert into #tmp values (1,'b*99-a')
    insert into #tmp values (1,'b1')
    In Perl or Python the last character of f2 wold need to be uppercase but because I have a case-insensative collation upper or lower case is accepted.
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

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