How to create MySQL trigger -
i have table users
2 fields id
(numeric) , email
(with full email adress) how add trigger can prevent adding new email
records specific domains eg: *@somedomain.com
?
the trigger this:
delimiter $$ create trigger user_insert before insert on user each row begin if new.email '%@somedomain.com' signal sqlstate '99999' set message_text = 'invalid domain'; end if; end$$ delimiter ;
Comments
Post a Comment