- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Also, LEN gets the right trimmed length already; if it was a string ' abc ' or 'abc ' or 'abcd', the result would be 4. Which is why if you need un-trimmed length, you do LEN(@str + 'x') - 1.
Admin
Common funk intervals are root, fifth, minor seventh and octave or root fourth root fourth tritone root tritone root
Admin
I'm sure you meant https://www.youtube.com/watch?v=iAmx_XdQky8, Remy...
Admin
Someone changed ints to strings after yesterday's WTF
Admin
I always declare my filenames as ints. Saves memory that way.
Admin
Don't ascribe to malice (or, in this case, obfuscation) that which can adequately be explained by stupidity.
Actually, the parameter probably started out life as a string, then got changed to int, and nobody noticed this line could be removed.
Admin
Sure, but the whole thing is overcomplicated. This is equivalent:
Even if we don't rely on the MSSQL quirk that trailing spaces don't count for comparison purposes, there's no point in LTRIM and RTRIM because you're looking for strings with nothing but spaces... so either will return empty string, no need for both. So, minus quirk, this is still much easier to read:
Admin
@Duston ref
If you restrict yourself to 8.3 names you can use
short
s instead ofint
s and save even more memory. ;)Admin
This just might be the realest RWTF.
Admin
That's a huge WTF right there. If I want right-trimmed length, I should have to explicitly ask for that
Admin
If you're using 8.3 file names, those are floats, right? Or was that left?
Admin
The reasons are found in ancient history, when fixed-width space-padded fields (on 80-column punch cards) were the norm.
Admin
They have a command DATALENGTH() to do this. Although, I very much agree that using a function name that matches a squillion other languages, and then having it behave in a subtly different way is a huge WTF ... even if the impact rarely an issue.
I have worked with SQL for years and didn't actually remember this (maybe I have come across it before, and forgot, like so many other things!). But then why would I look LEN() up in the language definition when it "seems" to behave as I'd expect?
Admin
Undoubtedly, but that itself is the WTF. Punch card compatibility is an excuse (and occasionally even a reasonable one) for COBOL, not for SQL.
Admin
It was developed by IBM in 70s. Old enough to need to deal with such things...
Admin
@MiserableOldGit ref
Not really. LEN() is expressed in logical characters. DATALENGTH() returns the number of bytes of actual storage used. So depending on the encoding, which Unicode character plane(s), combining diacritics, etc., those two can be very different numbers even if trailing spaces are not an issue.
Admin
The probability of the root of a number being an INT tends to zero.
Admin
Not for a char() column, surely?