An introduction to GUIDs starts with one problem: two tables that both count from 1. This post merges two small shop tables, first with INT keys and then with UNIQUEIDENTIFIER keys, and shows how to create, read and sort GUIDs. It also answers common reader questions: adding GUIDs, finding the newest row and getting the new key back. Every result comes from SQL Server 2025.
INSERT With an Identity Column: Name the Columns, Skip the ID
INSERT with an identity column is simplest when you leave the identity column out, because SQL Server numbers the row for you. This post shows three common errors (8101, 544 and 213), two ways to read the new number back, and what DELETE and TRUNCATE do to the counter. Every result comes from SQL Server 2025.
Identity Overflow Check: How Close Is Each INT Column to 2,147,483,647
A table with few rows can still be one insert away from error 8115. Here is a check that shows the real headroom of every INT identity column.
Explicit Identity Values: Loading Rows With Their Old Keys
Moving rows and keeping their old keys? Here is the safe order of steps, and the counter check that saves you from a collision.
Generate Script for Schema and Data in SQL Server: SQL in Sixty Seconds #021
To generate script for schema and data, choose Schema and data in the SSMS wizard and review the result before you run it. The tests here build such a script with T-SQL on SQL Server 2025 and show three ways it breaks: identity columns, apostrophes and the 1,000 row limit.
Identity Column Quiz: Why Did My IDs Skip a Number?
This Identity Column Quiz starts with three rows and one rolled-back insert, then asks what ID the next row gets. The answer is 5, not 4. A tested script proves it and shows two more ways numbers go missing.
Overriding Identity Fields: Put a Deleted Row Back With Its Old ID
Overriding identity fields is rare, but restoring a deleted row with its old ID needs it. This post uses IDENTITY_INSERT to put two workshops back with their old numbers. It shows the five errors you will meet, what happens to the next automatic number, and why gaps in an identity column are usually fine.







