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
Related
I have an ACCESS database that I'm using to test migration to SQL Server. It has one local table; no linked tables, forms, queries, or reports. One site said to use the open the Database Tools tab, and click the Access Database icon in the Move Data group. When I do, it tells me that the database must be split. How do I let ACCESS know that the database has been split?
The move data features up to Access 2010 ALSO had a feature to move data to SQL server. However, due to SQL server always changing and having new versions that come out at "different" times then ms-access?
the feature was deprecated, and versions of Access after 2010 don't have the move to sql server anymore.
If this is just say a simple single table, then it you can use SQL server studio to import the table. (but, you lose PK settings, and indexing, and relationships (assumes you have more then one table and related tables).
If you looking to migrate a lot of data, and a lot of tables?
Then it is high recommended that you use the Sql Server Migration Assistant for Access. (SSMAA).
It is a separate download. You can find SSMAA here:
Information on this tool, and download links can be found here:
https://learn.microsoft.com/en-us/sql/ssma/access/sql-server-migration-assistant-for-access-accesstosql?view=sql-server-ver16
While the tool has a learning curve, it is well worth the efforts for any type of serious data migration from Access to SQL server.
I just wanted to know if Microsoft's Studio has the following functionality of mySQLWorkbench:
After inserting, updating, deleting etc. cols in mySQLWorkbench using GUI, you clik on "Apply" and a new window pops up where you have your complete query according to changes you have made.
On the other side Microsoft's Server only offers that the user generates some predefined scripts, which should be changed manually each time.
So, perhaps i missed it, i want to be sure:
Does "Microsoft SQL Server Management Studio" offer the described functionality of "mySQLWorkbench" ?
mySQLWorkbench isn't primarily a Databse-Frontend, it's a Design- and Development IDE that could connect a Database-Server.
The Managementstudio is to manage and Maintain Servers. It#s intended to do a different Job though. But: you can do almost anything by drag and drop and by context menus you could get the resulting code to copy/paste or save it.
There is one important difference: With the Workbench you design in theory and might connect a server. With the MS SQL Management-Studio you always manipulate a real Server. That's why i've got here a Deploy Server, One Hot-Standby and a Developmentserver (Developeditions are quite cheap) for Development and Testing.
Transact SQL is something one should learn and understand as you will need it for stored procedures or trigger-programming. GUI clicking is nice to have, but at a certain point you will have to know what GUI is doing or will have to start your Editor. The Transact SQL Help is quite good. Just start!
Yes. Right-click on "Tables" and choose "New Table.." or right-click on an existing table and choose "Design". Make your changes in the designer, then right-click in the top pane and choose "Generate Change Script..."
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 am trying to run a query that will pull information from multiple servers. Let me explain a little bit. The machine that makes a certain product stores that information on a server. So when we do reports we have to run a query on the accounting side and then run a query on the first server. I was just wondering if anyone could point me in the right direction, or help me out a little with constructing this query.
Since you didn't technically specify, I'm assuming you're running the query in MS SQL Server and the other databases are either MSSQL or MySQL, guessing based on your tags.
If that's the case you have a couple options. If you're going to be running these queries frequently you can use a linked server or if you're only wanting to do them sparingly you can use OPENROWSET.
Other options would be to create a SQL Server Integration Services (SSIS) package to extract the data from various sources and compile it into a single report or alternatively SQL Server Reporting Services (SSRS).
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.