Tuesday 15 February 2011

SQL Server Database schema versioning and update -


For my application, I must support update scenarios and the database may be affected.

I want to be able to update from the old version to the latest without installing intermediate versions. Let's say I have version A (oldest), B (intermediate) and C (new version). I want to be able to update the version directly to version C It's easy for application files, I just change old ones with new ones. Although for the database I do not want to generate a SQL script to convert the database schema directly into C, instead I want to change the schema from A to change the schema and from B to C

How do I store a database version for a SQL Server database? Is there a special property that I can set to apply a version table instead? In my code (.net) I want to read the database version and accordingly update the updated SQL script in the proper order.

I will use both SQL Server 2005 and SQL Server 2008.

"post-text" itemprop = "text">

I use database extended properties, see:

  SELECT [value] to :: Fn_listextendedproperty ('MyApplication DB version', default, default, default, default, default, default);  

...

  EXEC sp_updateextendedproperty @name = N'MyApplication db version ', @value =' 1.2 '; Go  

No comments:

Post a Comment