Comparing Two SQL Server Databases: When, Why, and How

SQL Compare has a simple premise: it will compare the two SQL Server databases for schema differences. It will generate a script that will make the schema of a target database the same as that of the source database. This article explores all the ways this can be helpful during database development and deployment, from generating database scripts in version control, to detecting database drift, to auto-generating deployment scripts. Read more

Using Filters to Fine-tune Redgate Database Deployments

Filters are used by Redgate's SQL Compare, SQL Source Control, DLM Dashboard, and SQL Change Automation. A typical use for a filter is to work on just one schema within a database or just a limited set of tables and routines. You would also want to use a filter to exclude certain object, such as database users, from comparisons. Phil Factor explains how they work, and how to create, edit and then use them within the various Redgate tools. Read more

Database Build Breakers: Avoiding Constraint Violations during SQL Server Deployments

A common database build breaker is data that violates the conditions of any of the CHECK, UNIQUE or FOREIGN KEY constraints, and unique non-clustered indexes, designed to protect the consistency and integrity of your data. Phil Factor explain how to avoid this problem, using SQL Compare and some custom stored procedures to discover which rows will cause violations, and fixing them, before running the build. Read more

Deploying Data and Schema Together with SQL Compare or SQL Change Automation

You want to use SQL Compare or SQL Change Automation (SCA) to create or update a database, and at the same time ensure that its data is as you expect. You want to avoid running any additional PowerShell scripting every time you do it, and you want to keep everything in source control, including the data. You just want to keep everything simple. Phil Factor demonstrates how it's done, by generating MERGE scripts from a stored procedure. Read more

How to reformat a database in one operation

Inherited a database from another team? Changed your team policy on the way that you format SQL? What's to stop you formatting the code of an entire database nicely, when you're developing it? Manually, the process can take longer than you expect. Phil Factor demonstrates a simple 3-step approach to reformatting a whole database , in a single operation, using SQL Compare and SQL Prompt. Read more