Skip to content

Spaced-Out Strings

'I came across this in a code review not long ago:

code_one

Three things pop into my head when I see this sort of thing:

  • That’s hard to read

  • That’s a whole lot of parentheses

  • Whoever wrote it is unfamiliar with the SQL standard about comparing strings

It’s the last item in that list I want to talk about first, because the SQL standard specifies rules for comparing padded and unpadded strings that make that RTRIM unnecessary.

For one thing, the LEN function could care less about trailing spaces. It ignores them. Pays no mind whatsoever. Just watch...'...

http://www.sqlservercentral.com/blogs/the-monday-morning-dba-/2017/11/13/spaced-out-strings/

Trackbacks

Keine Trackbacks

Kommentare

Ansicht der Kommentare: Linear | Verschachtelt

Noch keine Kommentare

Die Kommentarfunktion wurde vom Besitzer dieses Blogs in diesem Eintrag deaktiviert.

Kommentar schreiben

Standard-Text Smilies wie :-) und ;-) werden zu Bildern konvertiert.

Um maschinelle und automatische Übertragung von Spamkommentaren zu verhindern, bitte die Zeichenfolge im dargestellten Bild in der Eingabemaske eintragen. Nur wenn die Zeichenfolge richtig eingegeben wurde, kann der Kommentar angenommen werden. Bitte beachten Sie, dass Ihr Browser Cookies unterstützen muss, um dieses Verfahren anzuwenden.
CAPTCHA

Formular-Optionen