Search code examples
sqlfirebird

How to make an efficient check constraint for an e-mail field in Firebird


How to make an efficient check constraint for an e-mail field in Firebird (if field value not null)?


Solution

  • You could use the SIMILAR TO operator to test against regular expression pattern, something like

    CHECK(emailfield SIMILAR TO '[[:ALNUM:]._%+-]+@[[:ALNUM:].-]+\.[[:ALPHA:]]+')