By Data Juggler Software www.datajuggler.com .
If you like this project, please donate it keeps us going!
Update: 5.19.2013 - You can watch a video on YouTube: https://www.youtube.com/watch?v=aJ6-bB0FvtM
DB Compare is a simple utility that compares the schema (Tables, Views, and Stored Procedures) of two SQL Server databases.
I do all my development on my local SQL Server instance and when I deploy new versions of web sites or web services I often wonder if the schema has changed or if I have only changed the code.
The source code consists of a Visual Studio solution that contains two projects that can be opened with Visual Studio 2010 or Visual Studio 2012.
Update 1.12.2014: The source code now targets the .NET Framework 4.5, but all of the code is compatible with .NET Framework 4.0 so you are welcome to revert back to the 4.0 version if you have a specific need.
DataClassBuilder.Net.Dll - This is the main code generation engine of RAD Studio Code Generation Toolkit, located at http://radstudio.codeplex.com .
In my completely biased opinion RAD Studio is the best C# code generator / data tier creator / stored procedure generator for C# and other .Net developers.
Watch the RAD Studio Intro Movie on YouTube to learn more: https://www.youtube.com/watch?v=zpfnlFjIhuk
Also the Data Juggler website is now live at www.datajuggler.com
In addition to the time savings that DB Compare saves me, I built this project to demonstrate RAD Studio Code Generation Toolkit. I think more developers would use it if they knew about it and how to use it properly.
Hopefully this project will become popular and also increase the popularity of RAD Studio, as there is alot of very useful code in the program.
One last thing, if you do wish to work on the code, I have another project called Regionizer, which is a Visual Studio Package that docks in the toolbar where the Solution Explorer or Properties Window is located, and will format a C# document into regions for Private Variables, Methods, Constructors, Events and Properties.
About DB Compare:
DB Compare is a simple tool that compares two instances of SQL Server and reports any schema differences in all tables, views and stored procedures to make ensure they are up to date.
To use the tool enter (or create) a connection string for the source database and target database and a Comparison Report is generated on screen that will report if the databases are equal or if they are not equal any differences are shown.
This is a sample project built using RAD Studio Code Generation Toolkit, which is located at http://radstudio.codeplex.com .
I made this project a seperate release because this project has a wider appeal as any SQL Server developer that works with local and production (or off site) copies of a database.
Here is a short scenario of what this tool saves me, perhaps you have similiar job duties.
I often have to maintain off site databases and ensure they are synchronized with my local development instances, but to ensure they are up to date I usually have to perfrom the following:
1. Script all tables, views and procedures from my development machine.
2. Script local records that are on the production server so I can reinsert them after the schema is updated.
3. Drop all the existing tables, views and procedures
3. Execute the scripts for the new schema
4. Reinsert the local records that are required to run the applications.
Now with DB Compare, I can script only the items that have changes, if any.
This should work on most SQL Server database tables, views and stored procedures.
One limitation is I am not sure how well this tool works with tables with composite primary keys (a primary key consisting of two or more fields) as I rarely if ever have a need for that.
If anyone encounters a need to add that functionality and YOU want to write the updates, I will help you with any knowledge I have about how RAD Studio works.
This tool works for all of my databases, but I create all of my database schemas the same so it works for my needs. If you encounter any problems please post them here and I will try and answer as fast as possible.
The Length, Nullability, and default values and precision and scale (for decimals) are compared for all fields, so most changes should be picked up by DB Compare.
Some field types could be skipped, but I know it works on the following field data types:
nchar, nvarchar, etc.
Most of string data types are supported.
I think I have all of the large ints, tiny ints, etc, but if I missed one let me know and I will update the method LoadDataFieldsSchema. Whether a field has a Primary Key is compared by DB Compare and if the field Is Identity (IsAutoIncrement) and thus read only.
Decimal I know is supported, and I worked somewhere that used Numeric instead of Decimal and I made an update, but I am not sure if that made it into the current code base. If you have a problem with Numeric, Decimal is the exact same as far as I have been told. It is an easy fix to update to support Numeric data type.
Money works the same as Decimal.
Unique ID (GUID)
Guids are supported
I know Date Time works, I am not sure about just Time, I never use that, I use decimals for time so report that if that is a problem for you.
Image and Blobs
Image blobs are NOT supported. I made a version that worked with blobs once, but it broke or over complicated every aspect of the stored procedure generator that I finally just decided to leave blobs out because I prefer storing paths versus storing binary images in the database.
Bits are supported.
There are probably more cannot think of at the moment, but it is 3 AM, so I am going to bed, enjoy!
The Stored Procedures are binarily (if that is a word) compared, so it checks for the existence of the procedure, and the binary comparison ensures the T-SQL is the same including parameters.
In the short testing I have done I added a parameter to an existing procedure in the target database, and ran DB Compare and the procedure was listed in the Comparison Report, that is the extent of the testing I have done, but the file DataClassBuilder.Net.Dll that is the 'Engine' of the code generation has been tested in production for over 5 years now on dozens of projects so this tool is listed as stable although I only worked on the project for a few days now because I needed this at work.
This program assumes from one client machine you can connect to both the Source & Target Databases via a connection string.
The project remembers the last set of connection strings; it has been on my to do list to to add a File Menu option to save sets of connection strings, but I have more work than I can do so I decided to publish and mayble someone else could contribute loading and saving sets.
Please support my web site www.daily-click.com which is a seniors and pet rescue email service. If you enjoy this product, please tell all of your family and friends and any pet owners about Daily-Click.com.