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
Unsorted lentils pouring into a grinder with a red pebble among them

Logical Order Is Not Execution Order: A Conversion Error WHERE Missed

July 7, 2009
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Error Messages, SQL Function, SQL Server

Reproduce a conversion error that survives a WHERE filter, inspect optimizer choices, and replace fragile casts with TRY_CONVERT or proper types.

Read More
Gouache painting: on a harbor quay, two pallet stacks of identical crates stand side by side after the same loading step

SUM ROWS Versus RANGE: Ties Change a Running Total

July 5, 2009
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Order By, SQL Server

SUM ROWS versus RANGE defines different running positions. Keep tie-breaking and peer grouping explicit when comparing the resulting totals.

Read More
Blue wooden pins beside a long empty terracotta tray.

CAST Without a Length: The Default Can Truncate Text

July 4, 2009
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

CAST Without a Length can silently choose a target width that is too short for the source text. I compare omitted and explicit lengths. The same conversion syntax can look harmless while losing the end of a string.

Read More
Gouache painting: beside an open brick kiln, the whole firing is stacked in neat rows, each brick slightly different in shade and length

STDEV and STDEVP: Choose Sample or Population

June 3, 2009
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts

STDEV and STDEVP report spread in the input’s units. Compare a sample, a full population, duplicates, NULL and a single observed value.

Read More
SQL SERVER - Difference Between Candidate Keys and Primary Key

SQL SERVER – Difference Between Candidate Keys and Primary Key

May 30, 2009
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Function, SQL Scripts

What is the difference between a candidate key and a primary key? A table can have many candidate keys, but only one of them becomes the primary key.

Read More
Gouache painting of a glass jar full of cream, slate blue and sage marbles on a wooden table, with a small wooden scoop and one loose marble in front

APPROX_COUNT_DISTINCT in SQL Server: Saves Memory, Not Time

May 29, 2009
Pinal Dave
SQL Performance
SQL Function, SQL Memory, SQL Performance, SQL Scripts

APPROX_COUNT_DISTINCT counts distinct values with almost no memory. Tested on 5 million rows, it was within 2.2 percent of the exact count and needed no memory grant, while COUNT(DISTINCT) asked for 436 MB. It was not faster.

Read More
SQL SERVER - Find Hostname and Current Logged In User Name

SQL SERVER – Find Hostname and Current Logged In User Name

May 26, 2009
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server, SQL Server Security

Connected to many servers in SSMS? HOST_NAME() and SUSER_NAME() show the hostname and current logged in user for any query window.

Read More
Previous 1 … 57 58 59 60 61 62 63 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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