using check constraint on email field in sql to restrict addresses
Posted on 2012-09-20
I am using sql server 2008 for a help ticket system and we are, not surprisingly, receiving quite a bit of spam--mostly from "gmail.com" spoofed addresses. One of the fields is an email address and I was hoping to use a check constraint to ensure that all emails come from the ".edu" domain.
I have been trying this without success and wonder if I am missing something or using improper syntax. There are times when I do not receive an error, but then it still does not prevent me from entering a restricted address.
I realize the best option is probably to use a captcha, but I am being asked to come up with another idea if possible.
I have tries each of these for the check constraint (not together). RSVP1_Email is the name of the email field I am trying to restrict to .edu addresses:
If this isn't possible, I thought about checking the addresses against those in another table, which brings up additional issues.
.Thanks in advance for your help.