Blog Post

Deploying Indexes with SQL Compare

,

I suspect many people assume this is the case, but a customer recently asked if SQL Compare handles indexes. It does, and this post shows the basics of index comparisons with no filters.

This is a part of a series of posts on SQL Compare on my blog. You can read other posts I’ve written by clicking the link.

The Setup

I have two databases that are completely synced from a schema perspective.

2023-10-30 13_56_53-SQL Compare - E__Documents_SQL Compare_SharedProjects_(local)_SQL2017.SimpleTalk

I’ll now create an index in Compare1. This is a simple index on a single table. I use this code:

CREATE INDEX IDX_mychar ON dbo.MyTable (Mychar)

Once I refresh the compare, I see this. Note that I’ve selected the table that has a difference and it shows the new index. This bottom left shows the scripted version of the code I ran above.

2023-10-30 13_58_13-SQL Compare - E__Documents_SQL Compare_SharedProjects_(local)_SQL2017.SimpleTalk

If I create the deployment script, I see the index in it, as shown here:

2023-10-30 13_59_03-Deployment

By default, SQL Compare includes almost all objects and that includes indexes. There are options to change the behavior with indexes, and I’ll cover those in future posts. You can also set a filter that might exclude indexes (or include those), but those are also future posts.

SQL Compare is a fantastic product for simplifying work and it does so much more than this. Give it a try if you own it or download an evaluation today.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating