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 set a landscape painting into a new wooden frame, the old frame leaning empty.

Adding IDENTITY to an Existing Column With ALTER TABLE SWITCH

May 4, 2013
Pinal Dave
SQL Tips and Tricks
SQL Identity, SQL Server, SQL Table Operation, Table Partitioning

Add IDENTITY to an existing column with an empty matching table, ALTER TABLE SWITCH, a reseed, and full dependency checks.

Read More
A hand raising a single vermilion pennant on a flagpole above a harbor full of moored boats.

Adding a NOT NULL Column With a Default to a Big Table

May 1, 2013
Pinal Dave
SQL Tips and Tricks
DBA, SQL Column, SQL Constraint and Keys, SQL Server, SQL Table Operation

Add a NOT NULL column with a default safely, distinguish metadata changes from row updates, and plan a staged Standard edition rollout.

Read More
Gouache painting of a wooden boat with a bare stern panel and a pot of red paint with a brush waiting beside it

Rename a Column or Table in SQL Server Safely

November 14, 2012
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Scripts, SQL Server Management Studio, SQL Table Operation

To rename a column in SQL Server, call sp_rename with the table and column name, the new name and the word COLUMN. This post tests the rename on a demo database and shows what it leaves behind: a broken view, an old constraint name and permissions that stay. It ends with a safe way to swap two column names.

Read More
Open poultry shears sit around an empty gap beside a cut piece of chicken on a clean board

CHECK Constraints and NULL: Why Unknown Passes the Test

August 13, 2012
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Error Messages, SQL NULL, SQL Table Operation

Why does a CHECK (Quantity > 0) happily store a row with no quantity? Three-valued logic, a small demo, and the NOT NULL fix.

Read More
A garlic press handles one clove through its single chamber while whole garlic bulbs stay outside

Updatable Views: When INSERT and UPDATE Work Through a View

August 9, 2012
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Error Messages, SQL Table Operation, SQL View

A view is only a doorway to the table behind it. I show which writes get through, which get rejected, and why CHECK OPTION earns its place.

Read More
A carpet stretcher pulls ripples flat while the carpet remains uncut and keeps its existing edges

ALTER TABLE REBUILD: Fixing a Heap Without a Clustered Index

August 8, 2012
Pinal Dave
SQL Tips and Tricks
SQL DMV, SQL Heap, SQL Index, SQL Table Operation

A heap with widening rows collects forwarded records. Here is how to measure them, fix them and know when the fix will not last.

Read More
A riveting tool aligns a new rivet with existing holes that preserve the old fastening positions

Explicit Identity Values: Loading Rows With Their Old Keys

August 7, 2012
Pinal Dave
SQL Tips and Tricks
Primary Key, SQL Identity, SQL Migration, SQL Table Operation

Moving rows and keeping their old keys? Here is the safe order of steps, and the counter check that saves you from a collision.

Read More
Previous 1 … 6 7 8 9 10 11 12 Next
  • Books
  • Testimonials
  • Privacy Policy

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