T-SQL reference › Collation
Collation in SQL Server: why two emails do not match
Collation is the rules for comparing text: case, accents, alphabet. A CI (case-insensitive) database treats Sam@ and sam@ as equal. A CS one does not.
See the rules
SELECT name, collation_name FROM sys.databases WHERE name = DB_NAME();
SELECT email FROM Customers WHERE email = 'sam@harbour.co';
If a join misses rows that look the same, check trailing spaces first (TRIM), then collation. Do not sprinkle COLLATE on every column as a habit. Fix the data or the column.
Try it on Harbour & Co
Amy Nair (Finance Lead) needs this now: “Mailing list for the newsletter. Some names have stray spaces and emails have capitals. Clean it, no duplicates.” Write the query, run it, send the results. On the paid plan.
Take the ticket →Learn it on a real ticket
Monday is free on WorkSQL. A colleague’s ticket lands, you write the T-SQL, we mark it. No videos. Five minutes.
Clock in free See Monday’s tickets