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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 substring or what

Author  Topic 

doran_doran
Posting Yak Master

179 Posts

Posted - 2008-06-05 : 23:25:47
Which function should I use so I can get rid of @domain.com . For example,

userID
john.scribble@quixter.com
mike.bailey@quixter.com
becky.berg@quixter.com

I want my result to look like

john.scribble
mike.bailey
becky.berg

Hope it makes sense.

Thanks

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-06-06 : 00:09:26
Left function.
Go to Top of Page

doran_doran
Posting Yak Master

179 Posts

Posted - 2008-06-06 : 00:27:18
sodeep, left function if wanted to extract number of characters from left. I need a function that will give me everything from the left excep @quixter.com.

Hope it makes sense now. see my example in the original post.

Thanks
Go to Top of Page

dshelton
Yak Posting Veteran

73 Posts

Posted - 2008-06-06 : 02:09:58
LEFT(field, CHARINDEX('@', field) -1)
Go to Top of Page

doran_doran
Posting Yak Master

179 Posts

Posted - 2008-06-06 : 07:51:56
Thank you very much. I tried following and it worked like I wanted to.

select id, email, LEFT(email, CHARINDEX('@', email) -1)
from [user]
Go to Top of Page
   

- Advertisement -