Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting a version of my database
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01547279
Message ID:
01547286
Views:
48
>Hi,
>
>I am looking for suggestions to "stamp" a number/version to a database. The purpose of such number would be when running an update script (script that changes/updates certain constraints of the database) I can check for this number. And if the number is, say, greater than so-and-so, skip sections of the script. For example, pseudo code as following:
>
>
>if [database version]  < 2.00
>   -- execute various SQL tables/constraints updates
>endif 
>
>
>Where in the database can I store such number? And what would be the syntax of checking the value of this number?
>
>TIA.

In out case we just use a table with one row called MetaData that has one row and two columns (Version, Other) and the following data (currently):
version	other
4.1 [4.1.03.0114]   	<EncryptionVersion>2.0.0</EncryptionVersion>
Each update scripts starts from checking the last backup and the version info and if it matches, performs update and last step updates this version to the latest version.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform