When RJ was trawling through some SQL Server stored procedure code, they spotted this line:

IF LEN(LTRIM(RTRIM(@funky_interval))) = 0 SET @funky_interval = NULL

Now, part of what drew RJ's attention was that @funky_interval was an input parameter to this stored procedure. So SETting it to a value was, if nothing else, a bad practice. A minor bad practice, but still.

What this line does is trim any whitespace off the value, and if the result is a string of length 0, then we set it to NULL. That's a pretty common idiom to say "hey, empty strings are nulls". There's just one problem, and it's in the definition of the input parameter:

@funky_interval INT

It's an integer. So while it could be null, it could never be an empty string. This entire line of code is useless. It's also worth noting that there's nothing "funky" about this parameter- the adjective seems randomly chosen, which leads RJ to only one hypothesis for why this code is here:

Possible purpose: obfuscation.

[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!