November 23, 2009 at 12:05 pm
I would update email address's in my database. The data looks like this:
I would like to update each address to a type field store in another column but leave the end part of their email address.
jhyue@yahoo.com = PR@yahoo.com
November 23, 2009 at 12:22 pm
Hi cm62587, something like the following is what you're looking for...
Assuming the column with the two-character code is in the same table:
UPDATE emailAddresseTable
SET emailColumn = codeColumn + RIGHT(emailColumn, LEN(emailColumn) - CHARINDEX('@', emailColumn) + 1)
You use the CHARINDEX to find the position of the @ character, and take the RIGHT of the email column from there.
November 23, 2009 at 12:30 pm
Thanks.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply