Search code examples
sql-serverdeploymentvs-web-application-project

How to update an already published database?


I have a web application that has an SQL database.

For clarity I'm using Asp.Net 4.0/c#/SQL Server 2008 Web edition.

I recently puclished the site, which was my first, by creating a deployment package for the database.

Now a couple of months down the line, I need to update the database structure. The web application now has data that has been entered via the web, so i'll need to update the structure, then copy data across.

As this is the first time I've done it, I'm unsure of the process I should follow - is there a standard practice for this kind of update?

Also, since some of the tables use incremental ID's I need to ensure they remain the same in the newly updated database.

Any tips, links, advice appreciated.


Solution

  • Important Guidelines:

    I assume you have not changed structure entirely (means keys column are same though solution is around for that too)

    Steps are as follows:

    1. Take export of the database
    2. Add or remove the columns or whatever changes you want
    3. Import the database back
    4. Check the log for rows/tables (if some) were not updated successfully
    5. Make SQL queries for them and run them to sync