Sometimes we need to add a database project to our project solution to manage the script and also for deployment purposes etc.
When multiple team members are working on a project and are continually adding scripts manually in the database project and a team member updates or adds a new object in the database and forgets to update the script in the database project in the solution for any reason then when the database project is deployed it's very hard to find the recently added scripts and schema.
So here is the solution.
Comparison, Comparison and Comparison between database script and database.
And, how to do this comparison? It's very simple; it barely took 5 minutes or it depends on your database size.
Have a look.
First we will create a sample project of WPF and add a new database project to it.
Now I will add a new database project to the solution and I will use the "Northwind" database as an example to add a script in this database project.
Then click "Start".
Now click "Finish".
A script will then be generated in our database project.
Now suppose we have created a new table "Test" in our database for development.
And we have forgotten to add the script "Test" table in our database project.
For this reason we will have to face the issue at the time of deployment.
CREATE TABLE Test
Now our new step is how to compare the script.
Now click "OK".
You will get the result.
In the result above we can see that the selected rows showing in this database object "Test" is missing in our database project.
And in the following pane we will see the script.