January 3, 2007 at 10:31 am
I need to replace or update email addresses. The address is in one field.
Example: emailname@emailaddress.net
Many (not all) of the emailaddress.net need to be replaced with a new email address. The email name needs to remain.
This is what I tried but I have something wrong.
SELECT = replace('emailaddress.net', 'emailaddress.net', '%@newaddress.net')
Then I tried this -
UPDATE dbo.tablename
SET email_address = %'@emailaddress.net'
WHERE email_address LIKE '%@newaddress.net'
I think I changed everyone's name to % with one of these. I at least am working on a copy of the database - and I am skilled and restoring my copy!!
Any help would be great!
January 3, 2007 at 12:38 pm
Update dbo.tablename
SET email_address = Replace(email_address, '@emailaddress.net', '@newemailaddress.net')
Syntax:
REPLACE(string, , )
Before you do an UPDATE, you can do a SELECT
SELECT email_address , Replace(email_address, '@emailaddress.net', '@newemailaddress.net')
FROM dbo.TableName
to see which rows get updated.
******************
Dinakar Nethi
Life is short. Enjoy it.
******************
January 3, 2007 at 12:57 pm
SELECT email_address , Replace(email_address, '@emailaddress.net', '@newemailaddress.net')
FROM dbo.TableName
This delivers all email addresses not just the email addresses ending in emailaddress.net. 20,000 emails vs 2,000. I messed around with it a bit and I am still doing something wrong.
More help needed - please.
January 3, 2007 at 1:11 pm
January 3, 2007 at 1:38 pm
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply