Visual Studio 2010 SQL Database Project Command-Line Schema Compare - visual-studio-2010

I use SQL 2008 Database Project to keep track of all my database changes and easilly update databases by running schema compares on them.
A bad thing is that I need to have VS2010 on the machine I want to perform the schema compare.
Currently I've been able to open a door on the remote servers and connect to them, executing the schema comprare on my machine but it would be great if I could execute everything right on the destination server.
Is there a way to perform a schema compare using nothing but the generated DB Project schemas?

I'm not sure why is it a bad thing that you have SQL2008 databases and work with VS2010. I do it every day. But if you just want to compare two DB schemas (meaning .dbschema files).here is an article on how to do it: http://msdn.microsoft.com/en-us/library/aa833435.aspx#comparewithvsdbcmd

Related

Oracle Developer Tools for Visual Studio 2017 (ODT)

I have created an Oracle Database Project Version 2 on visual studio 2017 and imported an existing database to the project to obtain the database schema on my project, and I got an SQLfile for such object in my project. The problem is when I'm modifying a table for example and saving the changes on my oracle database project and build it, I get a create script as output instead of an alter script so this script can't be deployed to my database due to "existing object error".
I tried to do it otherwise by proceeding to schema compare option:
I launched the schema comparison by mentionning my oracle database project as source and my database as target
The result of the comparison indicated that there is an non indentical object between the source and the target which was the table (because i added a coloumn to the table)
Again the problem is when I generate the update script it gives a drop/create table script instead of an alter and I can't deploy this script because I will lose data.
Does anyone have any ideas? how can I get the alter script by building the project or launching a schema compare operation?
I've found that comparing two databases DO generate a "somewhat" correct diff script (it may need some manual adjustment). So you can run the SQL file generated by the database project against a different oracle instance, and then compare both.

Visual Studio 2013 - DB Data Compare

I know you can compare and sync data between databases in Visual Studio using SSDT. But is there a way to compare DB data in DB project vs actual DB?
We currently use RedGate to sync schema and data and normally when someone makes a data change in their local DB he syncs it with redgate project scripts and checks them in to GIT so that everyone can sync their local DBs with those redgate scripts to be up to date. RedGate became too expensive and we are looking at the alternatives and looks like Visual Studio has SSDT that allows to do these kind of things.
So I was able to create a database project in VS and import the schema from the DB so now all developers be up to date if schema changes but it doesn't have an option to do the same thing with DB data. No option to create data scripts (and add them to the database project) to compare with DB, as I said it only allows you to do data compare between DBs but not between DB and the DB project scripts, at least that's what I found so far. Is there even a way to do it so that we can include data scripts and be able to sync them with DBs?
You could check in MERGE-scripts for static tables and include them as Post Scripts.
The merge statements will ensure that your target tables have the correct rows when publishing (insert/update/delete in the merge will do this).
Make one merge script file per table, and include them all in your Post Script File.
Only difference/downside is that you can not import into the merge script, you have to type in the code to get it version controlled, or write an SP that generates the SQL Merge statement.

TFS 2010 version control

We want to start using the TFS version control on our project. I read the tutorial and noticed that TFS creates tables in the sql db. My questions are:
What are these tables for?
Where is the vs solution actually stored?
How can I use more then one instance of our solution from another computer (another developer)?
TFS stores pretty much all its data in few SQL database: source control, work items, build definitions, build results etc.
In the SQL database for the Team Project Collection, specifics about which tables etc should not matter to you. Users setup a workspace which maps the directory structure in source control to a place on their local disk.
I'm not sure what you're asking here, can you try clarify your question?

Sql Server 2008 Database Project Delta Deployment

I have created a new Sql 2008 Database Project in Visual Studio 2010. I imported the database objects and only kept the stored procedures. That all worked as expected. Where I have the problem is that it tries to deploy the entire set of procedures each time. I expect it to only create the deployment script for the delta. I am pretty sure that I combed every setting, but I can't find it. So if someone could first validate that this is possible and second tell me where to look. I need to do this because we only deploy the stored procedures with each release, the database schema is not modified.
Do a Schema compare of the project (as source) with the database where you want to deploy (as target). Once shcem comparison results are shown you have a choice to select which changes you want to deploy and then click the button "Export to T-SQL Editor". It will create the delta script.

Managing database scripts in your solutions

I usually create a solution folder in Visual Studio and put my DB scripts in them. I always use at least this set of scripts:
Drop model
Create model script
User functions
Stored procedures
Static data (lookup tables)
Test data (not deployed)
Then I simply combine them and run against an SQL Server so I'm able to recreate the whole DB in a single step (by combining these scripts into a single one and executing it).
Anyway. I've never used projects in either:
Visual Studio or
SQL Management Studio
I've tried creating SQL Server 2008 Database Project in Visual Studio 2010, but I'm somehow overwhelmed by all the possible server settings (which I prefer to stay default as set on the server anyway). So I'm a bit confused: Should I use this project template or should I just do the same thing I always did?
What do you use and why? What are advantages I may benefit from by using either?
If I were you I would continue to do it the way you are doing it. In fact I do! The advantages of having the actual .sql files right there in a folder for you to use/edit/look at in my opinion are far better than the advantages you get by using a DB project. DB Project would be used if you were doing something like Storage Reports, were you have to communicate with like 8 databases and compare then to 8 different databases and save result sets etc... Now don't get my wrong there are advantages of Database Projects, I just don't think they are actually doing much help when you have such a simple setup that works already.
Advantages of the SQL Server 2008 Database Project in VS10:
Not having to switch back and forth
from your current client you use to
communicate with your SQL server.
Decent Data and Schema compare tools.
Gives you a one-click way to reverse
engineer a database into source
control, and keep it up to date.
You can compare projects to physical
databases and vice-versa. (This makes it pretty easy to keep your database up to date, no matter where you make change it: file system database project, or in the physical database itself)
If the current tool your using is not specifically tailored to SQL Server, this one is.
Extremely helpful if you need to do
unit tests directly on the database
without using abstractions.
If you're looking for something a little less complicated, you might want to try SQL Source Control. This won't even require you to maintain scripts, as it doesn't this for you behind the scenes. It will, however, only work as a solution for you if you use either TFS or SVN. And it costs $295...
It has a 28-day trial period, so if you're happy to try it out, I'd be interested in your feedback.

Resources