The story became a legend in their team: “Always review the actual generated deployment script before publishing—never trust the visual diff.” And they added a mandatory step to their CI/CD pipeline: generate the script, inspect it for hidden table rebuilds, then deploy.
But when she deployed to a pre-production staging environment that mirrored production data, disaster struck. The deployment failed with a bizarre error: “Cannot insert NULL into column ‘NewColumn’.” But the column definition had a DEFAULT value of GETDATE() ! How could it try to insert NULL? sql server data tools
Here’s an interesting, true story about SQL Server Data Tools (SSDT) that captures both its power and its occasional “surprise factor.” The story became a legend in their team:
After an hour of panic, the senior DBA looked at the actual script SSDT generated for that specific environment. Because the staging table already had 50 million rows, SSDT didn’t just add the column with a default—it created a new temporary table with the new schema, inserted all 50 million rows into it (leaving the new column as NULL because the default was applied at table creation, not during the bulk insert), renamed the tables, and swapped them. The default constraint was there, but the insert operation into the temp table never invoked it. The column was NULL for every existing row, violating the NOT NULL constraint. How could it try to insert NULL
A few years ago, a mid-sized financial analytics firm had a critical reporting database. Every night, a complex ETL process ran, and every morning, executives got their dashboards. The team used SSDT for version control and deployments—modeling the entire database schema as a Visual Studio project.