This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting of pairs of large and small cups on a shelf with one small vermilion cup

Case-Sensitive WHERE Clause: COLLATE Without Losing the Seek

March 15, 2021
Pinal Dave
SQL Tips and Tricks
SQL Collation, SQL Scripts, SQL Search, SQL Server, SQL String

A case-sensitive WHERE clause needs a COLLATE on the comparison, but the obvious version scans the index. A demo measures 286 reads against 2, and shows two fixes: keep the plain test beside it, or give the column a case-sensitive collation.

Read More
Gouache painting of a windowsill of cacti with the tallest one wearing a vermilion cork cap

Escape Text for JSON: Build Valid JSON With STRING_ESCAPE

February 16, 2021
Pinal Dave
SQL Tips and Tricks
JSON, Quotes, SQL Scripts, SQL Server, SQL String

To escape text for JSON, pass each value through STRING_ESCAPE, so JSON built by hand stays valid. A demo shows which characters it escapes and which it leaves alone. It also shows when JSON_MODIFY and FOR JSON make it unnecessary.

Read More
Gouache painting of a sorter board with round beads and a rejected square vermilion block

Digits in a Column: A CHECK Constraint for Digits Only

February 1, 2021
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Scripts, SQL Server, SQL String

To keep only digits in a column, a CHECK constraint with NOT LIKE and a character range works, but it has two holes. It accepts an empty string and digits from other scripts. A demo closes both and shows NULL, trust and fixed length codes.

Read More
Leeks trimmed at both ends on a chopping board, roots and tough tops in two small piles.

LTRIM and RTRIM With Custom Characters in SQL Server 2022

January 26, 2021
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Server, SQL Server 2022, SQL String

Use LTRIM and RTRIM with custom characters in SQL Server 2022, understand character sets, test TRIM directions, and preserve valid text.

Read More
Folded patterned fabrics of different thicknesses share a shelf

What is N in nvarchar? – Interview Question of the Week #301

January 21, 2021
Pinal Dave
SQL Interview Questions and Answers
SQL Datatype, SQL Server, SQL String

Question: What is N in nvarchar?

Answer: n in nvarchar or nchar stands for world national. Let us learn today about datatypes.

Read More
Gouache painting of pears in a divided crate beside a loose pile of pears, with one vermilion pear in the grid

Grid vs Text Output in SSMS: Why Line Breaks Disappear

January 15, 2021
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Server Management Studio, SQL String

Grid vs text output is a Management Studio setting that decides whether the line breaks in your data stay visible. This post builds a value with a line break, proves with T-SQL that the data holds it, and shows how to keep the break in each mode.

Read More
Woven strips of different widths occupy fixed compartments and flexible storage channels.

SQL SERVER – Unicode Storage and UTF8 Version Limits

September 30, 2020
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Scripts, SQL Server, SQL String

nchar and nvarchar are usual types for Unicode character strings in SQL Server. Reader questions prompted my datatype summary.

Read More
Previous 1 2 3 4 5 … 22 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com