Finding Special Characters in Email Address

  • Hi All,

    I have to find the special characters in email address apart from alphabets, numbers

    SELECT EmailAddress AS ValidEmail

    FROM Contacts

    WHERE EmailAddress LIKE '%_@__%.__%'

    AND PATINDEX('%[^a-z,0-9,@,.,_,\-]%', EmailAddress) = 0




    Sathish Kumar

  • Is there a problem with the code you posted?  I've not spent a lot of time looking at the code but I think you need to change the " = 0 " to "<> 0" in order for it to find the bad rows.

    If that's not the issue, please provide any errors your code may produce.  "Same day rule" applies. 😉

    --Jeff Moden

    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • This was removed by the editor as SPAM

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply