Microsoft SQL Server Management Studio: creating scripts like in mySQLWorkbench - mysql

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..."

Related

SQL server management studio review script like MySQL Workbanch

In MySQL Workbench, you are able to preview a script before it is applied. Ex:
1.) Select * from any_table
2.) Modify one a value in one of the rows returned
3.) Click apply
4.) you are presented with a review script dialogue before it is applied (See image)
Does SQL Server Management Studio have similar functionality
This seems pretty similar to the following SQL Server Management Studio functionality:
From the SQL Server Management Studio object explorer window, right click on a table then:
"Script Table as"
"Update to"
"New Query Editor Window"
Long story short: no there is nothing that allows you to view the scripted out edit of live data similar to that. The best SSMS has to offer is the "edit top 200 rows" option and then editing the SQL behind it to accomodate for where clauses etc...
It will automically script out and run the script right when you make the data change. But there is not really a "Review" piece to it.
Would be nice though...

How to access SQL Server Publishing Wizard 1.4

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.

How to compare schemas in SQL Server 2008

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

VS2010 ultimate DataBase Project + SQL Server 2008: Updating Project from Database

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.

Color coding SQL Server 2008 databases

I often have multiple databases open in SQL Server 2008. Often they are prod, dev, and dr. It is annoying because each window says something generic like SQLQuery1.sql... (sa(200))*. So I have to hover over the tab and make sure I am in the correct window.
Is there a way to color code each window, or in some way to make it instantly knowable which database or server I am in?
Jonathan
Yes, you can color-code connections in SQL 2008, by modified the properties of the registered server. There is a "Use Custom Color" option on the Connection Properties tab.
See this cool tutorial video by the Midnight DBA
I'm not sure about changing the colors, but I got tired of the small tab truncating the window name. As a result I run them as windows, so the entire DB name shows in the window's frame.
I have 2005 (shouldn't be that different than 2008) and this is where I made the change:
tools - options:
environment
general
MDI Environment