I've SQL Server databases and do alterations in them. Some database tables have records which are beginning records needed my application to operate. I must do version treatments for database which records (rows). Can you really do that and bundle it to SVN version control I've for my source code or exist other methods to this? I must make this happen to have the ability to go back to previous version of database and compare changes between database revisions. It might be nice if tools with this have the freedom, free or not so costly.
My atmosphere is Visual C# Express, SQL Server 2008 Express and Tortoise SVN.
Check this out question: http://stackoverflow.com/questions/4952/database-version-control
Static data support has been put into SQL Source Control 2., presently obtainable in beta. A lot of how to do this are available here:
We have just began doing the next on a lot of our projects, also it appears to operate very well, for inhabiting "static" tables.
Our scripts consume a pattern in which a temp table is built, and it is then populated using what we would like the actual table to resemble. We simply put human readable values here (i.e. we do not include IDENTITY/GUID posts). The rest of the script takes the temp table and works appropriate Place/UPDATE/Remove claims to create the actual table resemble the temp table. When we must change this "static" data, all we must update may be the population from the temp table. Which means that DIFFing between versions works not surprisingly, and rollback scripts are as easy as obtaining a previous version from source control.
The Place/UPDATE/Removes just be written once. Actually, our scripts are a little more complicated, and also have two teams of validation run prior to the actual DML claims. One set validate the temp table data (i.e. that we are not likely to violate any constraints by trying to create the database resemble the temp table). Another validate the temp table and also the target database (i.e. that foreign secrets can be found).
For database (schema) versioning we use custom qualities, that are put into the database once the installer is went. The items in these scripts is produced with this build scripts.
The script to create the qualities appears like this:
DECLARE @AssemblyDescription sysname SET @AssemblyDescription = N'DailyBuild_20090322.1' DECLARE @AssemblyFileVersion sysname SET @AssemblyFileVersion = N'0.9.3368.58294' -- The extended properties DatabaseDescription and DatabaseFileVersion contain the -- AssemblyDescription and AssemblyFileVersion of the build that was used for the -- database script that creates the database structure. -- -- The current value of these properties can be displayed with the following query: -- SELECT * FROM sys.extended_properties IF EXISTS (SELECT * FROM sys.extended_properties WHERE class_desc = 'DATABASE' AND name = N'DatabaseDescription') BEGIN EXEC sys.sp_updateextendedproperty @name = N'DatabaseDescription', @value = @AssemblyDescription END ELSE BEGIN EXEC sys.sp_addextendedproperty @name = N'DatabaseDescription', @value = @AssemblyDescription END IF EXISTS (SELECT * FROM sys.extended_properties WHERE class_desc = 'DATABASE' AND name = N'DatabaseFileVersion') BEGIN EXEC sys.sp_updateextendedproperty @name = N'DatabaseFileVersion', @value = @AssemblyFileVersion END ELSE BEGIN EXEC sys.sp_addextendedproperty @name = N'DatabaseFileVersion', @value = @AssemblyFileVersion END GO
You can aquire a version of SQL Management Studio for SQL Server Express. In my opinion you'll have the ability to make use of this to create scripts from the schema of the database. I believe which will make you to produce scripts manually for placing the beginning records.
Then, invest the scripts into source control, together with an expert script that runs the person scripts within the correct order.
You'll have the ability to run diffs using windiff (free with Visual Studio SDK), otherwise Beyond Compare is affordable, along with a great diff/merge/sync tool.