• erikd (4/22/2013)


    Well, this gets me the very end of an email. Not exactly what I was looking for. Oh well.

    with rt as (

    select right(email, len(email) - charindex('@', email)) as [rtemail]

    from el_table

    ), rt2 as (

    select right(rtemail, len(rtemail) - charindex('.', rtemail)) as [rt2email]

    from rt

    )

    select rt2email

    from rt2

    where charindex('.', rt2email) = 0

    PASRENAME does do it's separation on periods but that doesn't mean you can't use nested replaces to utilize it. Perhaps if you can post some sample data and what you are trying to extract I can help. Your requirements changed quite a bit from the first post (looking for domain names) to your last post (trying to extract email addresses).

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/