I have a SQL Server 2008 database (call it productionDB) that contains data and will be used in a production environment.
I have another SQL Server 2008 database (call it stagingDB) that is used in a staging environment.
The application that I am working on continues to evolve such that I am often making changes to the database schema (namely adding/editing tables and adding/editing stored procedures).
Up to this point, every time I have made changes to stagingDB I have generated scripts (via the SQL Server Scripts Wizard) that will drop/create all the schema. So, when I ran the scripts on the productionDB, it would successfully get updated to the updated schema, but all data that productionDB had would be lost - which has been fine, up til now.
Moving forward, I would like to generate scripts that will keep the existing data in productionDB as well as update its schema.
I cannot find an option(s) in the SQL Server Scripts Wizard that will do what I am describing.
Is the SQL Server Scripts Wizard capable of doing what I am looking for? If so, how?
I'm not really aware of any way in SQL Server to automatically do what you want, but you may find commercial applications (Such as those supplied by companies like RedGate) that do what you want, but it is a very complex subject matter and there will always be scenarios that can't really be managed. I've always found a better scenario to script your modifications to Staging in such a way that they can be re-run against live. So you write scripts to amend the table structure - that way you maintain both the staging and live data when the scripts are run.