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
Two hands holding a daisy chain of joined flowers, a single loose daisy on the grass beside them

Storing Emoji and Short Messages: nvarchar, UTF-8 and Length

April 9, 2012
Pinal Dave
SQL Tips and Tricks
SQL Collation, SQL Datatype, SQL Server, SQL String, Unicode

Store emoji safely with nvarchar or UTF-8 varchar, compare LEN and DATALENGTH, and choose message limits that fit full Unicode.

Read More
Three open boxes of different sizes, each holding three dark balls, one ball in each box painted red.

CHAR, VARCHAR, NVARCHAR and VARCHAR(MAX) Quiz: How Many Bytes?

January 16, 2012
Pinal Dave
SQL Puzzle
SQL Column, SQL Datatype, SQL String, Unicode

This CHAR, VARCHAR, NVARCHAR and VARCHAR(MAX) Quiz stores the text abc in three columns and asks how many bytes each one uses. The answer is 10, 3 and 6. A tested script proves it and shows the trailing space trap, the question mark problem and the 8,000 byte limit.

Read More
Two nearly identical white teacups on saucers, one with a small mark on its rim.

Collation Sensitivity Quiz: Does ‘jose’ Match ‘José’?

January 7, 2012
Pinal Dave
SQL Puzzle
SQL Collation, SQL Error Messages, SQL String, Unicode

This Collation Sensitivity Quiz asks whether jose matches JOSE and José in a case-insensitive, accent-sensitive database. The answer is JOSE yes, José no. A tested script compares three collations and shows the width and kana settings too.

Read More
One brass key blank fits a precise profile jig while a similar blank with a different ridge rests outside

LIKE Character Ranges: [a-f], [^0-9] and Collation Traps

August 9, 2011
Pinal Dave
SQL Tips and Tricks
SQL Collation, SQL NULL, SQL String, Unicode

A bracket range sounds simple until the collation decides what sits between a and f. Test it once so a bad code never reaches your table.

Read More
Table of eight shop names with the character code of each apostrophe and whether LIKE found it. Three straight marks, code 39, were found. Two curly marks, code 8217, were not found

Finding Apostrophes in SQL Server Text: Straight and Curly

August 3, 2011
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Search, SQL String, Unicode

Finding apostrophes in SQL Server text takes one trick and one trap. The trick is doubling the quote inside a LIKE pattern. The trap is that text can hold a curly apostrophe, and the usual search skips it. This post tests both on a table of eight shop names.

Read More
A hand crushing the corners of an oversized parcel to force it into a street postbox slot.

Parameter Types From .NET: Stopping Implicit Conversions at the Source

June 16, 2011
Pinal Dave
SQL Performance
DotNet, Execution Plan, SQL Datatype, SQL Server, Unicode

Match parameter types from .NET to SQL Server columns, avoid implicit conversions, and inspect cached plans for mismatched strings.

Read More
Two identical glasses of water, one with a red drop sinking in it

Rows That Look Identical but Are Not: Finding Hidden Characters

April 1, 2011
Pinal Dave
SQL Tips and Tricks
SQL Collation, SQL Server, SQL String, Unicode

Expose hidden characters with DATALENGTH and UNICODE, clean known whitespace safely, and add a constraint to prevent recurrence.

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

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