Ralph B. submitted today's scary code snippet, found in a script used for "cleaning up" data from a widely used and well-respected data source for use in another widely used and well-respected data source.

It's not so amazing that this code does work, but there has to be a better way to do this. I'm not a SQL guy, but maybe another script is needed to clean up the clean up script...  

UPDATE OWNER_USER.all_candidates SET name = filter(translate(REPLACE(REPLACE
(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace
(REPLACE(replace(replace(replace(replace(replace(replace(replace(replace(replace
(replace(replace(replace(replace(replace(replace(replace(REPLACE(REPLACE(
    name,
CHR(1),null),CHR(2),null),CHR(3),null),CHR(4),null),CHR(5),null),CHR(6),null),
CHR(7),null),CHR(8),null),CHR(9),null),CHR(10),null),CHR(11),null),CHR(12),
null),CHR(13),null),CHR(14),null),CHR(15),null),CHR(16),null),CHR(17),null),
CHR(18),null),CHR(19),null),CHR(20),null),CHR(21),null),CHR(22),null),CHR(23),
null),CHR(24),null),CHR(25),null),CHR(26),null),CHR(27),null),CHR(28),null),
CHR(29),null),CHR(30),NULL),CHR(31),NULL))),
[... repeated nearly verbatim for the 32 other columns in the table...]
));

 Apparently this isn't the worst of it. Wrote Ralph, "You don't even want to *know* what the filter() and translate() procedures look like..."

No, Ralph. No, I don't.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!