SQL Puzzle 5: Prime Magic
Quite a few of you have read or attempted the previous puzzle SQL Puzzle 1: Magic Squares
As a quick reminder, when...
2018-01-05 (first published: 2017-12-19)
1,677 reads
Quite a few of you have read or attempted the previous puzzle SQL Puzzle 1: Magic Squares
As a quick reminder, when...
2018-01-05 (first published: 2017-12-19)
1,677 reads
I’ve been taking a bit of a deep dive into understanding Transparent Data Encryption (TDE). As part of that I’ve...
2017-12-28 (first published: 2017-12-12)
3,229 reads
More and more people are considering some level of encryption against their data stored in SQL Server. In many cases...
2017-12-14 (first published: 2017-12-05)
4,255 reads
I’ve not done a SQL puzzle for a while so thought it was getting overdue…
I set this one for my...
2017-11-24 (first published: 2017-11-08)
1,505 reads
When I was writing my post Capture the most expensive queries across your SQL Server using Query Store a question crossed...
2017-11-16
655 reads
I’m a big fan of using queries based on the dynamic management view sys.dm_exec_query_stats to capture the most resource hungry...
2017-11-13 (first published: 2017-11-01)
5,229 reads
In my post about auditing tools in SQL Server I mentioned a few tools we have at our disposal for...
2017-11-06 (first published: 2017-10-24)
4,885 reads
SQLCMD variables can be a useful way of having changeable parameters for your SQL scripts, allowing you to specify the...
2017-11-01
10,619 reads
Unlike some other languages, T-SQL doesn’t have the concept of a constant.
As good coders, we’ve all at some point tried...
2017-10-19 (first published: 2017-10-10)
3,687 reads
I love the STATISTICS IO and STATISTICS TIME commands. They are such a powerful and easy way to be able...
2017-10-17
519 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...
WhatsApp CS 628218520154 Jl. Suryopranoto No.40, RT.12/RW.7, Petojo Utara, Kecamatan Gambir, Kota Jakarta Pusat,...
WhatsApp CS 628218520154 Jl. Pegangsaan Timur No.1, Cikini, Kec. Menteng, Kota Jakarta Pusat, Daerah...
WhatsApp CS 628218520154 Jl. Pintu Air Raya No.36 Q, RT.6/RW.1, Ps. Baru, Kecamatan Sawah...
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