Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

sql

firebird

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

thanks, Wilfried

like image 371
Wilfried Visser Avatar asked Feb 22 '23 20:02

Wilfried Visser


1 Answers

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

CHECK(emailfield SIMILAR TO '[[:ALNUM:]._%+-]+@[[:ALNUM:].-]+\.[[:ALPHA:]]+')
like image 183
ain Avatar answered Apr 27 '23 17:04

ain