January 1, 2004 at 8:35 pm
1
Edited by - sloanthrasher on 01/01/2004 8:36:17 PM
Sloan
If you can't do it in SQL, get a bigger hammer!
January 1, 2004 at 10:22 pm
how is answer #2 different than #3 ???
G.
January 2, 2004 at 4:02 am
quote:
how is answer #2 different than #3 ???
There's an extra () making the syntax invalid.
Brian Knight
http://www.sqlservercentral.com/columnists/bknight
Brian Knight
Free SQL Server Training Webinars
January 2, 2004 at 7:23 am
No there isn't, they're exactly the same
Option 2:
UPDATE FORUM_MEMBERS
SET M_EMAIL = REPLACE(M_EMAIL,'@123.com', '@abc.com')
WHERE M_EMAIL LIKE '%@abc.com'
Option 3:
UPDATE FORUM_MEMBERS
SET M_EMAIL = REPLACE(M_EMAIL,'@abc.com', '@123.com')
WHERE M_EMAIL LIKE '%@abc.com'
Option 1 has the extra brackets...
January 2, 2004 at 7:29 am
The replace values are switched around.
'abc.com','123.com'
vs
'123.com', 'abc.com'
January 2, 2004 at 11:38 am
Although I got the right answer, one does have to make a couple of significant assumptions to get there:
1) The company uses the simplest form of its domain in all e-mail addresses (as opposed to jsmith@mail.abc.com, which is not incredibly uncommon).
2) The named column is, indeed the one that holds the e-mail address.
Not to mention that company 123 is unlikely to immediately discard the abc.com domain name, meaning that the best solution for the savvy database guru is that maybe a global replace isn't necessary - users should be notified of the need to update the e-mail addresses, and should update the addresses themselves.
Of course, the savvy database guru also knows when to go ahead and do something because someone up the corporate ladder decides it has to be done and done now.
R David Francis
R David Francis
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply