Recent IMs/TXTs


follow mjlevittation on twitter.com

55 authors don't know the name of the company

Today, Craig pointed out the need to globally update author bio's (55 of them) to reflect the fact that the company name changed over a year ago.

Justin and I got into a bit a "spitting contest to figure out an elegant way to accomplish this. We came up with the same solution around the same time. This might be trivial to some of our developers, but SQL can be a refreshing change and challenge from the typical production work we're faced with.

Feel free to let comment or suggest better ways to accomplish this.

Back to work....

--mark

--Look them up to confirm:
SELECT CONCAT("http://admin.oreillynet.com/cs/admin/view/au/",cs_rid) AS "Author Page"
FROM au
WHERE short_bio LIKE '%O''Reilly & Associates%'
OR bio LIKE '%O''Reilly & Associates%';
---------------------------------------
--Confirm that the UPDATE you're about to make will work:
SELECT REPLACE(short_bio, 'O''Reilly & Associates', 'O''Reilly Media, Inc.') AS short_bio,
       REPLACE(bio, 'O''Reilly & Associates', 'O''Reilly Media, Inc.') AS bio
FROM au
WHERE short_bio LIKE '%O''Reilly & Associates%'
OR bio LIKE '%O''Reilly & Associates%';
----------------------------------------
--Make your UPDATE
UPDATE au
SET short_bio = REPLACE(short_bio, 'O''Reilly & Associates', 'O''Reilly MEdia, Inc.'),
    bio =  REPLACE(bio, 'O''Reilly & Associates', 'O''Reilly Media, Inc.')
WHERE short_bio LIKE '%O''Reilly & Associates%'
OR bio LIKE '%O''Reilly & Associates%';

...rinse, wash, and repeat for other potential cases of the company's old name (e.g. O'Reilly and Associates, O'Reilly & Associates etc.).

TrackBack

TrackBack URL for this entry:
http://www.levittation.com/mt/mt-tb.cgi/8

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)