none
Updating database RRS feed

  • Question

  • Hello all...

     

    I would like to create an update-application for our companiy's product.

    one of it's features is to update database (add/remove tables, columns, indexes, keys etc...)

     

    what is the most recommended way to do this (without deleting the customer's database)?

     

    another important thing is that it could be updated from any version (even if the user missed a few updates - he's database should be updated)

     

    thanks in advance

    Nissim Trabelsy

    Thursday, July 10, 2008 7:56 AM

Answers

  • If you need to update structure of database objects, you could use ALTER statements to do this. ALTER works pretty much the same way as CREATE statements, but it changes existing objects (tables, columns, indexes, etc) without deleting data (unless you drop specific objects). For cumulative updates, you would need to keep all the ALTER scripts and execute them in specific order as they would be applied if client did not miss any changes. ALTER statements could be executed from the code using ExecuteNonQuery method of SqlCommand or could be applied from the Management Studio of SQL Server

     

    Friday, July 11, 2008 10:40 AM
    Moderator

All replies

  • If you need to update structure of database objects, you could use ALTER statements to do this. ALTER works pretty much the same way as CREATE statements, but it changes existing objects (tables, columns, indexes, etc) without deleting data (unless you drop specific objects). For cumulative updates, you would need to keep all the ALTER scripts and execute them in specific order as they would be applied if client did not miss any changes. ALTER statements could be executed from the code using ExecuteNonQuery method of SqlCommand or could be applied from the Management Studio of SQL Server

     

    Friday, July 11, 2008 10:40 AM
    Moderator
  • Thank you so much!!!... I forgot all about ALTER...

     

    Gooday

    Sunday, July 13, 2008 6:12 AM