Comparing email and NT name in MSSQL

  • Hi All

    I need help with comparing the first part of the email address before the @ sign against an NT login name. As i need to resolve the conflicts with Domain Admin

    I used the below code to validate the emails first

    select email

    from table1 where

    patindex ('%[ &'',":;!+=\/()<>]%', email) > 0 -- Invalid characters

    or patindex ('[@.-_]%', email) > 0 -- Valid but cannot be starting character

    or patindex ('%[@.-_]', email) > 0 -- Valid but cannot be ending character

    or email not like '%@%.%' -- Must contain at least one @ and one .

    or email like '%..%' -- Cannot have two periods in a row

    or email like '%@%@%' -- Cannot have two @ anywhere

    or email like '%.@%' or email like '%@.%' -- Cannot have @ and . next to each other

    or email like '%.cm' or email like '%.co' -- Camaroon or Colombia? Unlikely. Probably typos

    or email like '%.or' or email like '%.ne' -- Missing last letter

    Tx

    It's better to fail while trying, rather than fail without trying!!!

Viewing post 1 (of 1 total)

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