From: Eric Russell on

The problem is the "..." you have specified before the email server name:
replace(sentto,'...@google.com','')

The replace function doesn't do a LIKE comarison search; it can only replace
one literal string with another. What my previous example does is remove all
occurrances of "@google.com" from [sentto] and then use a LIKE comparison to
determine if any other servers remain.

"TG" wrote:

> Eric,
>
> I tried ur approach by using the following:
>
>
> select fileid as [id],sentto
> into temp_domain
> from emails
> where sentto like '%@google%'
>
>
> select * from temp_domain
>
>
>
> declare @T table (temp_domain varchar(8000))
>
>
> select sentto
> from @T
> where replace(sentto,'...@google.com','') like '%@%'
>
>
> select * from temp_domain
>
>
>
> but I don't see any difference. I see all the records still there.
>
> What is wrong?
>
> Thanks a lot!
>
> Tammy
>
>
>
From: TG on
Eric,

I got it to work as follows:

select t.*
into temp_domain
from temp_emails_all t
where (replace(sentfrom, '@google.com', '') like '%@%')


but now i need to exclude also if for example email is as follows:

Smith, John [john.smith(a)NYC.google.com]



unless there is another email in the same record e.g @yahoo.com, I
don't want to show the record....pretty much like the example from
before.

Thanks a lot, Eric!

Tammy
From: TG on
Eric,

Does the replace, delete stuff????

Thanks!

Tammy
From: sqlnovice on
TG,

No replace donot delete stuff forexample it replace characters you
specified in the replace condition

"TG" wrote:

> Eric,
>
> Does the replace, delete stuff????
>
> Thanks!
>
> Tammy
>
From: TG on
okay maybe I explained it wrong what i need...i don't want to replace
characters....I want to show only records that do not have
'@google.com' in the sentto field....but i might have record that has


michael.jordan(a)hotmail.com; jan.smith(a)google.com;
robert.jophnson(a)yahoo.com


in this case I want to still keep the record...because there are other
emails attached to the google one.

I hope this helps understanding what I am looking for.

Thanks a lot!


Tammy