Many times we come across a requirement which requires us to implement certain methodology to check for valid EmailID entries. The following article will try to achieve the same using CHECK constraint in T-SQL.
We have used the following understanding of valid EmailID's:
First letter should be alphabet
Length of Email part before @ should be <= 15
@ should appear only once
Dot (.) should appear only once and after @ and should have at least one alphabet between them.
After dot only alphabets should appear with length limited to 1 to 3 characters
Should not have any special characters and only AlphaNumeric
CHECK constraint to check for valid EmailID entries in table
Examples of invalid Inserts
Examples of valid Insert
No comments:
Post a Comment