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
A lunch thermos retaining one prepared meal for repeated servings

CTE or Temp Table: Choosing Where an Intermediate Result Lives

October 3, 2023
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

A CTE is a name, not a saved result. Build both versions on 20,000 rows, compare the plans, and see why the answer is never always one or the other.

Read More
A pear tree trained flat against a brick wall, a finger tracing one branch from the trunk to a single pear.

Materialized Path Hierarchies: Storing the Path as a String

August 28, 2023
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL String, SQL Table Operation

Build a materialized path hierarchy in T-SQL, query descendants, calculate depth, and move a subtree without creating cycles.

Read More
column exists

SQL SERVER – Checking If a Column Exists in a Table

August 24, 2023
Pinal Dave
SQL Tips and Tricks
Schema, SQL Column, SQL Table Operation, System Object

Let us see a script that will help check if a Column Exists in a Table. One of the common tasks that developers deal with when working on database-related projects

Read More
A cheese press holding differently sized portions beside equivalent weighed pieces

Unit of Measure Conversions: One Table for Kilograms, Pounds and Boxes

August 23, 2023
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

Adding kilograms, pounds and boxes gives a number that means nothing. Convert each product to one base unit and find the rows that cannot convert.

Read More
Hands lifting a colored pane from a salvaged window to fill the one gap in a stained glass window

Recovering One Dropped Table From a Full Backup

December 23, 2021
Pinal Dave
SQL Tips and Tricks
DBA, SQL Backup and Restore, SQL Table Operation

Recover one dropped table through a separate restored database, choose the recovery point, copy its data, and rebuild the table rules.

Read More
Gouache painting of a xylophone with grey bars on the left and vermilion bars on the right, with a mallet beside it

max_column_id_used: How Many Columns a Table Once Had

July 29, 2021
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL DMV, SQL Scripts, SQL Table Operation

The max_column_id_used column shows how many columns a table ever had. See it grow, find tables that lost columns, and avoid treating column_id as a position.

Read More
A standard collar fitting remains separate from vessel-specific inspection tools.

SQL SERVER – Legal CASE Defaults and Row Dependent Values

July 21, 2021
Pinal Dave
SQL Tips and Tricks
SQL CASE, SQL Scripts, SQL Server, SQL Table Operation

A CASE Expression can appear in a default, but cannot reference another row column there. My earlier blanket prohibition was incorrect.

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

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