Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kieran5405
Yak Posting Veteran
96 Posts |
Posted - 2011-07-08 : 10:13:14
|
hi,i am selecting a column with email addresses in it. i now need to also select just the text before the '@' symbol of the email addresses. how can i do this?thanks for any help... |
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2011-07-08 : 10:15:42
|
case when charindex('@',yourField,0) > 0 then Substring(yourField,1,charindex('@',yourField)) else null endCorey I Has Returned!! |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-07-08 : 10:57:20
|
quote: Originally posted by Seventhnight case when charindex('@',yourField,0) > 0 then Substring(yourField,1,charindex('@',yourField)-1) else null endCorey I Has Returned!!
MadhivananFailing to plan is Planning to fail |
 |
|
kieran5405
Yak Posting Veteran
96 Posts |
Posted - 2011-07-08 : 12:41:56
|
thanks i got that working great. i just want to highlight for others looking for this solution...that at first glance i didnt see the '-1' in red in the 3rd post and copied the 2nd. without the -1 the @ symbol still remains...but thanks to both contributors for their help. |
 |
|
|
|
|