SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

How to Exclude Entire Sections in VS Schema Compare

Right now I am so excited, and a little embarrassed.  After using Visual Studio (VS) for database projects for the last 7 years, I am just now finding out about this feature?!  What feature is that, you ask?  Let me tell you…

When using VS for database projects I typically use my environment specific Publish xml file to deploy changes to my local database when experimenting with code changes.  However, every once in a while I will have to use the New Schema Compare tool from the Tools | SQL Server menu when I have a “one-off” database that I need to synch to my database project.

Quite frequently because these are one-off databases there will be a ton of junk items that are in the database, but not in my database project or lots of objects in my project that aren’t in my database.  Either way I want to ignore those changes.  In the past, I’ve always manually unchecked each item, tedious when you have more than two items to uncheck.

SQLSchemaCompare2

I always thought there should be a better way than having to manually uncheck each object, but never thought more about or how to do it.

Well, today I figured it out.  All you have to do is right click on the section and ta-da, you can Include or Exclude all objects depending on the existing state of the objects.  So in the image below, I right click on Delete, select Exclude

SQLSchemaCompare3

and I’m left with the following:

SQLSchemaCompare4

In just one click instead of 14 (if I wanted to exclude all the table drops).

Like I said, I have no idea why it took me so long to figure this out, but surely I can’t be the only person who didn’t know this, so now you do too.


SQL Swimmer

I started out as a software developer back in 1996 in Denver, CO, doing Client/Server development in PowerBuilder. I am now a Data Architect, living in High Point, NC and I love what I do. I’ve worked with all versions of SQL Server since the infamous split from the Sybase code (a.k.a. version 4.21a). I’ve worn all the hats that come with dealing with SQL Server, developer to data architect and everything in between. Twitter handle: @SQLSwimmer

Comments

Leave a comment on the original post [sqlswimmer.wordpress.com, opens in a new window]

Loading comments...