• Bradley Deem (5/6/2015)


    Unfortunately, I don't have a SQL Server example, but here's the code in Oracle using SQLPLus. The key to this solution is to carry the upgrade version in a script variable that would survive DDL and DML changes.

    Interesting. Certainly you can track db version in the database. quite a few vendors do this and it works well as long as you can keep control of the db and ensure no drift (changes unexpected) to the database. Otherwise your version scripts still need idempotent code to account for things.

    However I'm curious, if your script fails halfway through, you have a version at 7U, not 6 or 7 and now your upgrade script won't run. Do you manually reset to 6 and your script skips the sections that worked? Do things roll back?