Link to home
Start Free TrialLog in
Avatar of lbarnett419
lbarnett419

asked on

Parse Email String

I need to separate the prefix of the email..that is, everything before the @ in a select statement:
susie@mysolution.com becomes susie


Avatar of chapmandew
chapmandew
Flag of United States of America image

select left(emailfield, charindex('@', emailfield)-1)
from yourtablename
Avatar of lbarnett419
lbarnett419

ASKER

This error is returned. I am on SQL Server 2003, not 2005. Does that make a difference?
Msg 536, Level 16, State 3, Line 1
Invalid length parameter passed to the substring function.

(90 row(s) affected)
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That did it! Thank you!