Alter instead of drop and recreate
Cat_Bill
Posts: 7 New member
Is there a way to force SQL Change Automation to use alter instead of drop and recreate when renaming a table? I don't want to lose the data in the table.
Tagged:
Best Answer
-
way0utwest Posts: 312 Rose Gold 1Not directly. The tools work by looking for changes, and there isn't a way to detect that this is a rename v a drop and add, at least not easily. When you import the migration script, that is the time to change this. I'd take this script:And edit it to be this:As a side note, renaming objects is an anti-pattern that you should avoid where possible. That being said, it is necessary sometimes. While SQL Prompt has a smart rename to find references and ensure things are renamed, for tables/columns, you need to manually fix the migration script.Editor, SQLServerCentral
Answers