How can we help you today? How can we help you today?
vincentj
I finally rewrote my deployment scripts as I mentioned above. I ran into one other issue along the way, and I figured I'd document my efforts here in case anyone else finds it useful. When I chose to sync just tables (excluding foreign keys), I got this error: Msg 3723, Level 16, State 6, Server MACHINE, Line 1 An explicit DROP INDEX is not allowed on index 'dbo.table1.pk_table1'. It is being used for FOREIGN KEY constraint enforcement. It's trying to remove an index on a table, but that index can't be removed because it's referenced by a foreign key. But since I've told it to ignore foreign keys, the script doesn't include the necessary DROP CONSTRAINT. (As a side note, the release notes for SQL Compare 9 say this has been fixed, but I'm using 9.0.0.79 and I still saw this error.) I tried adding IncludeDependencies to the options, as well as Default (based on feedback from another thread, heh) and IgnoreIndexes (hoping to push the whole mess off until the tables were synced) but none of those worked. I managed to work around it by adding two more steps to my deployment script, here's what I eventually came up with: 1. Sync NEW tables only, excluding foreign key constraints. We need most of the default options except IncludeDependencies. SqlCompare.exe /options:DecryptPost2KEncryptedObjects,IgnoreFillFactor,IgnoreWhiteSpace,IgnoreFileGroups,IgnoreUserProperties,IgnoreWithElementOrder,IgnoreKeys /include:Table /exclude:additional /exclude:different /exclude:identical ... 2. Sync data for all tables. This will include the tables we just added so we will be able to enforce the foreign key constraints on those new tables. SqlDataCompare.exe ... (no special options here) 3. Sync ALL tables, this time we can include foreign keys because the new tables have already been added and populated. Again, we use the default options except IncludeDependencies. SqlCompare.exe /options:DecryptPost2KEncryptedObjects,IgnoreFillFactor,IgnoreWhiteSpace,IgnoreFileGroups,IgnoreUserProperties,IgnoreWithElementOrder /include:Table ... 4. Sync data for all tables again. This is unlikely to add anything new, unless we've added a new column to an existing static data table. SqlDataCompare.exe ... (no special options here) 5. Sync the rest of the database objects. SqlCompare.exe ... (no special options here) This could still fail if you need to add a new primary key field to an existing static data table, populate that field, and then enforce a foreign key constraint against the new field. But that is a very unlikely scenario, so I'm considering this good enough for our purposes. It still seems way more complicated than it needs to be, and I can't imagine I'm the first person to do this... do everyone's build scripts look like this, or am I just missing something? (Edit: updated the options for steps 1 and 3; it was dropping and recreating all the indexes with the defaults excluded.) / comments
I finally rewrote my deployment scripts as I mentioned above. I ran into one other issue along the way, and I figured I'd document my efforts here in case anyone else finds it useful. When I chose...
0 votes
Yes, we're using linked servers. Is there a timeframe for that feature to get added? I need to decide whether it is worth waiting or if I should implement another solution. / comments
Yes, we're using linked servers. Is there a timeframe for that feature to get added? I need to decide whether it is worth waiting or if I should implement another solution.
0 votes