Re: Limited String return for displaying

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Roji. P. Thomas (thoasroji_no_spam__at_gmail.com)
Date: 10/27/04


Date: Wed, 27 Oct 2004 19:10:04 +0530

Try this

DECLARE @vchemail VARCHAR(50)
SET @vchemail = 'jdoe@mail.com'
SELECT LEFT(@vchemail, CHARINDEX('@',@vchemail)-1)

-- 
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"CD" <mcdye1@hotmail.nospam.com> wrote in message 
news:ujiu4cCvEHA.2116@TK2MSFTNGP14.phx.gbl...
>I am wanting to do a query from a table that has the full stmp mail address
> in it.  Is it possible to return just the name part and not everything 
> after
> the @ sign?
>
> Table.mailaddy:
> jdoe@mail.com
> msmith@mail.com
> mjohnson@mail.com
>
> select mailaddy from table  -- not display everything after the @ sign.
>
> RESULTS:
>
> MailAddy
> ----------------
> jdoe
> msmith
> mjohnson
>
>
> TIA
> C
>
> 


Relevant Pages

  • Limited String return for displaying
    ... I am wanting to do a query from a table that has the full stmp mail address ... select mailaddy from table -- not display everything after the @ sign. ...
    (microsoft.public.sqlserver.programming)
  • Re: Limited String return for displaying
    ... SELECT LEFT(YourCol, CHARINDEX('@', YourCol) - 1) ... SQL Server MVP ... > I am wanting to do a query from a table that has the full stmp mail ... > select mailaddy from table -- not display everything after the @ sign. ...
    (microsoft.public.sqlserver.programming)