Altering a column with indexes

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Altering a column with indexes

Postby anna.p » Wed Apr 24, 2013 10:59 pm

Hi there,

I compared two tables that were identical except for a changed datatype on ColumnA and some indexes, one of which accessed ColumnA - we'll call it IDX_ColumnA. My goal was to sync the datatype of ColumnA and nothing else. I turned off the "Indexes" option hoping it wouldn't attempt to sync them.

Here's what I wanted the script to do:
    DROP INDEX IDX_ColumnA
    ALTER COLUMN ColumnA
    CREATE INDEX IDX_ColumnA

Instead, what it included was DROP INDEX statements for all those that existed in the target but not the source, and then the ALTER COLUMN.

Is there any way I can achieve what I want?
anna.p
 
Posts: 23
Joined: Tue Jul 03, 2012 10:59 pm

Postby Brian Donahue » Mon Apr 29, 2013 1:45 pm

Hello,
SQL Compare only drops indexes when it absolutely needs to allow SQL Server to accept the changes. Without knowing the schema I can't say why the indexes are being dropped in your case. So there may not be an option that you can set to avoid it.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Compare 10

Who is online

Users browsing this forum: Bing [Bot], Calpertyk, Yahoo [Bot] and 1 guest