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)
 returning LEFT of '@' in email addy

Author  Topic 

chad
Starting Member

11 Posts

Posted - 2005-11-30 : 09:15:01
Can anyone help me out? I'm trying to return everthing to the left of the '@' in email addresses.

thanks!!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2005-11-30 : 09:15:21
select left(@email, charindex('@', @email) -1)

-----------------
[KH]
Go to Top of Page

chad
Starting Member

11 Posts

Posted - 2005-11-30 : 09:24:17
khtan, thanks.

I just tried the below and received: "SQL script containing the text '@' cannot be processed."

select left(@epemail, charindex('@', @epemail) -1) from veperson
select left(@epemail, charindex('@', epemail) -1) from veperson

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-30 : 09:34:10
Is this working?

select left(@epemail, charindex('@', epemail) -1) from veperson


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

chad
Starting Member

11 Posts

Posted - 2005-11-30 : 09:56:15
I can't get it to work.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-30 : 09:59:33
Declare @sql varchar(100)
set @sql='test@test.com'
select left(@sql,charindex('@',@sql)-1)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-11-30 : 11:11:18
>>I just tried the below and received: "SQL script containing the text '@' cannot be processed."

Where/how are you testing this? what is generating that error message?
Go to Top of Page
   

- Advertisement -