Fredo

DerFredo aka Thomas holds a degree in Business Economics, but has been a data explorer and a developer at heart ever since the days of dBase and Turbo Pascal. He touched his first SQL Server at V6.5, used covering indexes before they became a feature and joined the PASS community in 2006.

Thomas has been developing in Navision/Dynamics/Business Central systems for quite some time (since 2001, one year before MS acquired Navision), got his hands on R in 2014 (the year before MS bought Revolution Analytics), on the Power Platform from 2020 and the Arduino world from 2024 on. He has worked for ISVs as well as end-user companies, as a developer, consultant, accidental data engineer and is an author for data-related articles as well as a speaker at data events across Europe.
  • Skills: SQL, R, BC, ERP, Arduino

Blogs

Goodbye, Microsoft

By

A few years ago I took a new job at Microsoft, working as a...

The SUM of Nothing: #SQLNewBlogger

By

I caught this interesting item over on Pinal Dave’s blog: Eleven Interview Questions that...

How to Move the SSMS Status Bar to the Top and Color-Code SQL Server Connections

By

I use color-coded connections in SSMS to distinguish Production, Pre-Production, UAT, and Development. But...

Read the latest Blogs

Forums

Today's AI

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Today's AI

Split Large Queries in Athena with a Simple Modulo Trick

By Rahul Gupta

Comments posted to this topic are about the item Split Large Queries in Athena...

Finding Trailing Spaces

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Finding Trailing Spaces

Visit the forum

Question of the Day

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        Sally
I 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