SQL Code Review - Scalar Variables
One very common mistake I see when reviewing code is the case where the select statement is returning multiple rows,...
2008-09-14
539 reads
One very common mistake I see when reviewing code is the case where the select statement is returning multiple rows,...
2008-09-14
539 reads
I'm starting a series of blog posts from the Business of Software conference
that I attended last week in Boston. If...
2008-09-12
769 reads
It's been two weeks since I got the Kindle. Actually it will be two weeks in a few hours. I've...
2008-09-12
988 reads
I'm starting a series of blog posts from the Business of Software conference
that I attended last week in Boston. If...
2008-09-11
800 reads
I'm not usually much of a beta software guy, but I saw the new Chrome browser (http://www.google.com/chrome) from Google last...
2008-09-11
772 reads
2008-09-11
427 reads
One of the big decisions around vacations is whether it should be a 'do something' vacation or a 'do nothing'...
2008-09-11
1,258 reads
It's pretty common to see a mild plea from blog authors asking for feedback, or ideas about which to write...
2008-09-10
424 reads
PASS asked all speakers to update their blogs with news about the event (a good idea), so here's my post!
I'll...
2008-09-10
390 reads
I'm starting a series of blog posts from the Business of Software conference
that I attended last week in Boston. If...
2008-09-09
817 reads
By Steve Jones
I caught this interesting item over on Pinal Dave’s blog: Eleven Interview Questions that...
By Hemantgiri
I use color-coded connections in SSMS to distinguish Production, Pre-Production, UAT, and Development. But...
Comments posted to this topic are about the item Split Large Queries in Athena...
Comments posted to this topic are about the item Finding Trailing Spaces
I have some data in a SQL Server 2025 database. It looks like this for the dbo.Customer table:
CustomerID CustomerName PreferredName 1 Steve Steve 2 Andy Andy 3 Brian Brian 4 Allan Allan 5 Devin Devin 6 Steve Steve 7 Sally SallyI want to detect which names have a single trailing space. The CustomerName is a varchar() and the PreferredName is a CHAR(). Does this query detect the problem rows?
SELECT
CustomerID,
CustomerName,
PreferredName
FROM Customer
WHERE CustomerName <> RTRIM(CustomerName)
OR PreferredName <> RTRIM(PreferredName); See possible answers