this is a quick question:
I have this Database Project in a Web app solution with the real database. I want to update the database using SQL server managment studio, and then update the corresponding VS project.
This can be done?
I know that you can update the scripts in the project, but I'm not the SQL kind of guy, i rather do this changes using Mangment studio...
Thanks in advance
Update: Okay, the point is that I want to make changes (if I have to) on the database, using Sql Server Managment studio, and then update the scripts in the Visual Studio DataBase Project, instead of make my updates on those scripts, because I don't feel confortable writing SQL commands. Now what I do is to recreate everytime the Database Project (delete and then create again), this is what I want to avoid
Also, I have Visual Studio 2010 Professional.
It is very achievable in VS2010 Premium and I am currently doing what you describe with a Database Project and a Schema Comparison item.
Sigd is not correct in saying you can only compare Database/Project Compare, you can also compare Project / Database and Database / Database
You can achieve this using the Schema Compare feature, but this is only available with the Premium or Ultimate editions of Visual Studio, not the Professional edition.
In many cases this is possible using Red Gate SQL Compare Pro, although I should warn you that this is not a fully supported scenario just yet (I'm the product manager for this tool so I'd welcome your feedback if you go this route!).
Red Gate's SQL Source Control better fulfills your suggested way of working, although this won't help you just yet as we don't tie into VS Database Projects. Again, this is something we are considering for an upcoming release. You're welcome to try it and let us know what you think.
http://www.red-gate.com/products/SQL_Source_Control/index.htm
If only the Schema Compare tool did what it's name suggests.
Unfortunately it is a "Database/Project Compare". So my project which includes only a single schema, when compared with the database, generates loads of Create actions for all the other schema objects present in the database.
Nice idea, needs work.
Related
So, I'm trying to get set up my MySQL and ASP.NET.
Currently, I have both Visual Studio 2013 and Visual Studio 2015 installed on my PC. I used this installer for MySQL (Basically one that comes with everything you need to get started, including MySQL For Visual studio): MySQL Installer
Anyways, as a quick test I made a new ASP.NET MVC project, connected to the database in the server browser (which works just fine!). However, I then tried to create an ADO.NET model from it. When I come to the step of generating the model from the database, I get this error/exception:
This happens in both Visual Studio 2013 and Visual Studio 2015.
I have tried to search my way out of this (I've also tried with different databases, I used some of the sample databases included with the MySQL server installed, still got the same error), but I don't seem to be able to find much information on it. Additionally, it might be worth noting that when I select the version of the Entity Framework to use, I get this:
Which seems odd as I'd think the newest MySQL installer did actually include MySQL for Visual Studio which supports EF 6.x?
Anyways, any assistance or hints on this problem will be much appreciated :)
EDIT - Narrowed down the problem a bit
So, I found out that this problem occours whenever I have a database with foreign keys in. Still no clue why, but databases without them I can easily generate!
Try to run this command on MySQL WorkBench:
set global optimizer_switch='derived_merge=off'
Good luck!
If you have many schema inyour database, the Global parameter is not your solution.
test with : set session optimizer_switch='derived_merge=off' to impact your schema and not the entire base
I am working with SQL Server and I have two databases - one for development and another one for a live users.
I want a way to move the changes (create new tables, SP, functions, modifications, relations, indexes) from development database to a live database automatically
now I am copy the script for each element and execute it on the live database
there are few ways how to achieve this. I don't want to make any advertisement here, but in my job I found RedGate SQL Compare most suitable to do this. Same can be achieved by using Visual Studio 2010 database project. Unfortunately I don't know any free tool actually.
I found a solution on Visual Studio 2010 in Scheme Compare under Data menue
I can choose the servers and databases I want to compare and then it will show the difference between it and the two databases and then we can automaticlly write these changes from source database to target database
I've had a big problem in replicating a simple SQL Server 2008 R2 Express database for use on a development server. I thought I had it sorted but it turns out that each table has lost it's 'Identity' value somewhere along the line, and it's not possible to add those back in now. This is pretty much useless. So I'm back at square 1; having to get a copy of a MSSQL database plus data from a web server to another web server.
I've read that SQL Server Publishing Wizard does this, and maintains crucial things like identity settings etc. Trouble is, I'm working with SQL Server 2008 R2 Express and I can't actually seem to find a way to access that program anywhere - even though when I go to 'control panel > remove programs' it's in there. When I try to find it on my system (e.g. via start > find programs / files) it's nowhere.
Does anyone know how to access this program, and will it do what I need?
Thanks!
Sure thing, thanks Michael. So the solution was to connect to the database through VWD 2010 Express, which has the options required to do this. There are actually some really great third party tools which do database migrations from one system to another detailed here: http://erikej.blogspot.co.uk/2009/04/sql-compact-3rd-party-tools.html. The ones on this page are geared specifically at SQLCE migrations, but several of the tools also support other full SQL versions too.
Can someone guide me on how can I compare schemas in SQL Server 2008.
I want to do so to check if sql objects already exists and if they exists is there any change between the existing and the new one.
You can compare schemas in SQL Server 2008 and any new SQL Server with ApexSQL Diff and it has free Community edition.
It has user friendly UI, where you can easily pick your databases (or other data sources as backups, source control projects, script folders) compare them, get results with differences and to synchronize from source to destination database.
If you just want to compare objects to only see differences and create a merge script, you can check out a free tool - ApexSQL Compare.
One more tool that can do a job that you want is dbForge Schema Compare
Get a tool such as Red Gate's SQL Compare.
You'll need to pay for it, but it pays for itself through time saved.
It is available on a trial basis if you have an immediate need.
I don't recommend you do that if you can avoid it.
If you just want to compare two SQL Server databases, I recommend a low cost alternative http://cdttools.com/sql-diff-erence/. (caveat: I wrote it).
However for what you are referring to I recommend a different approach. you should already know the different version of the various schemas for your product that you have already shipped. So build a change script based on upgrading each of them completely to your latest version. That way you installer only has to detect a single version number and chooses its sql actions based on that.
If you really really really want to do SQL comparisons during an installer yoo might want to take a look at the SMO (Shared Management Objects) that are part of the SQL server feature pack. But you will most likely have to install those before you can use them.
Then you can use them to generate the scripts for each SQl object and do a comparison in your installer. However I honestly don't recommend this.
It will tell you if they exist, and allow you to generate either "alter" or "create" script versions. Alternatively you can go directly to the INFORMATION_SCHEMA database system objects that will allow you to query directly for objects existence.
In Visual Studio 2012, go to SQL (menu item) -> Schema Compare. Click on Select Source on the left, and select the dev database. Select the production database on the right.
Then click on the generate script icon (next to the Update icon, it looks more or less like a music icon). That will generate the update script. You may also untick any of the changes that you do not want to include in the script. And it is ... 'free' if you happen to own Visual Studio 2012
We are developing an application with Visual Studio 2008 and TFS. Our database is a MySQL DB. As we develop we keep the new queries that need to be applied to the database of our new release as the New Version Update Queries. Right now I'm keeping them in a simple text file (which is a painful task!). I know that TFS integrates with MSSQL and makes this job very easy. I've already asked our consultant from Microsoft if there is any way to integrate TFS and MySQL, and his answer was "NO". So I was wondering if anyone knows any smart way of handling this issue?
I think the question may be a little misleading in that I think you're saying TFS when you mean Visual Studio. My guess is that you are looking for a MySQL provider to hook into VS2008 so you can use the database developer features (DataDude) with it? TFS itself is simply a server that provides source control and work item tracking services and isn't designed to work with anything other than MSSQL.
Visual Studio's data tools can be hooked into other databases using the Database Schema Provider interfaces (it's a 2010 feature). An implementation exists for Oracle, but nothing yet exists for MySQL.
My suggestion would be to store your scripts in TFS as regular source controlled items, and keep doing what you are doing until someone writes a DSP for MySQL.