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 a row of clay pots with the first few filled with soil and a vermilion scoop in a soil bag

DEFAULT WITH VALUES: Fill Existing Rows on a New Column

June 27, 2020
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Constraint and Keys, SQL NULL, SQL Scripts

DEFAULT WITH VALUES fills the rows that already exist when you add a column with a default. Without it, a nullable column keeps NULL in every old row. This post shows the three cases side by side, what a default never does, why the constraint needs a name, and how a large table takes the change in a millisecond.

Read More
Gouache painting of pears spread evenly across a market table with one vermilion pear in the middle

Nonclustered Primary Key Test: Last Page Insert Waits

May 11, 2020
Pinal Dave
SQL Performance
Primary Key, SQL Constraint and Keys, SQL Identity, SQL Wait Stats, Testing

A nonclustered primary key test shows whether a heap fixes last page insert waits. On SQL Server 2025 it doesn’t, because the key index still rises. A lane layout that spreads the inserts removes the latch wait, and the post shows the cost of that layout.

Read More
Illustrated cover: Last Page Contention

SQL SERVER – Last Page Insert PAGELATCH_EX Contention Due to Identity Column

May 5, 2020
Pinal Dave
SQL Performance
Primary Key, SQL Constraint and Keys, SQL Identity, SQL Scripts, SQL Server, SQL Server Management Studio, SQL Wait Stats, Testing

Today’s goal is to understand what is the Last Page Insert PAGELATCH_EX Contention Due to Primary Key. Let us start understanding it together.

Read More
A hand holding a tulip bulb, paused above a spot where a shoot already grows in a garden bed.

Loading Only New Rows: INSERT SELECT With NOT EXISTS

December 25, 2019
Pinal Dave
SQL Tips and Tricks
Duplicate Records, SQL Constraint and Keys, SQL Scripts, SQL Server

Make loading only new rows repeatable with NOT EXISTS, EXCEPT, source deduplication, and a unique key that protects the destination.

Read More
Gouache painting of a wall of small drawers with one pulled open showing a vermilion key

Show Primary Key of a Table in SQL Server With sp_pkeys

August 14, 2019
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Scripts, SQL Stored Procedure, System Object

To show primary key columns for one table, call sp_pkeys with the table name. This post builds a small demo database, reads a single column and a composite key, and handles schemas and errors. It also lists every key in a database with one catalog query.

Read More
Two toggle clamps securing a wooden piece against separate reference blocks

Foreign Key Checks in Insert Plans: The Cost of Each Constraint

June 13, 2019
Pinal Dave
SQL Tips and Tricks
Primary Key, SQL Constraint and Keys, SQL Server

Before you drop a foreign key to speed up a load, look at what it costs. This walk-through shows the Assert, the two parent lookups, and the trust trap.

Read More
A revolving punch making one specified round hole beside differently shaped test holes

Enforcing Formats With a REGEXP_LIKE Check Constraint

June 10, 2019
Pinal Dave
SQL Tips and Tricks
Comprehensive Database Performance Health Check, SQL Constraint and Keys, SQL Server

Stop badly shaped product codes before they reach a report. A short, tested walk-through of anchors, NULLs and adding the rule to old data.

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

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