Seven benefits for using the SQL Server Management Studio(SSMS) for managing the SQL Azure Database:
Long awaited build of SQL Server Management Studio with support for SQL Azure is available here. This support is included as part of the November CTP release of SQL Server 2008 R2. Here are the download links for SSMS in 32bit and 64bit flavors.
Following are the seven benefits that you get from SSMS for managing the SQL Azure Database.
1. Seamless navigation:
There will always be cost associated with learning a new tool and becoming an expert. SSMS is a well known tool for managing databases in on-premises Sql Server. The extended support of SSMS for managing SQL Azure Databases same way as it is used for on-premises sql server will be a great value add for customers.
Connecting to SQL Azure Database:
Ø Open SSMS ( type SSMS in command prompt)
Ø It opens up SSMS with connection dialog. Type server name, login name and password in the connection dialog.
Ø If you would like to connect to a particular database, click the “Options>>” button in above dialog, it will take you to “connection properties” page. Enter the database name in “Connect to database field”.
It will try to connect to “TestDB” database and opens following Object Explorer in SSMS.
SQL Azure follows the strict containment policy i.e. it will try to connect to particular database. User has to explicitly make different connections to manage different databases.
If user doesn’t specify the “Connect to database”, SSMS tries to connect to master database. Following is the screenshot of Object Explorer when user connects to “master” database:
If a particular database name is explicitly provided in connection dialog, SSMS will show up only that database hierarchy even though user has permission to connect to “master” database.
If user would like to manage logins or more than one database, he /she should connect to “master” database.
Query editor is a popular tool for executing T-SQL queries. In addition to executing the T-SQL queries, following are three important features that are supported when connected to SQL Azure Database as well.
Estimated Execution plan: When estimated execution plans are generated, the Transact-SQL queries or batches do not execute. Instead the query execution plan that SQL Server Database Engine would most probably use if the queries were actually executed will be displayed.
Actual execution plan:
When actual execution plans are generated, the Transact-SQL queries or batches execute. The actual query execution plan that the SQL Server Database Engine uses to execute the queries will be displayed.
Client Statistics: When Include Client Statistics is selected from the Query menu, a Client Statistics window is displayed upon query execution. Statistics from successive query executions are listed along with the average values. Select “Reset Client Statistics” from the Query menu to reset the average.
Some of the Query Editor Features which are not supported when connected to cloud are TSQL Debugging and intellisense.
. Object scripting:
This feature in SSMS lets you script out an object from one server to any other server (could be different version / type). Following example shows how to script out an object “User” from standalone SQL Server (SQL 2000) to SQL Azure.
- Connect to the standalone SQL server.
- Go to the Tools->Options. It opens up Options dialog. Go to the SQL Server Object Explorer-> Scripting. Change the “Script for database engine type” to SQL Azure Database.
You can also set different scripting options based on your interest.
- Go to the User object in Object Explorer and script using “Script User as” option.
It will generate the script which is executable on SQL Azure database.
You can also get the script for an object from SQL Azure database to on-premises sql server of interested version.
. Database Migration:
Lot of customers would like to migrate their databases from on-premises Sql Server (SQL 2000/SQL 2005/SQL 2008) to SQL Azure. SSSM provides “Generate Script Wizard”, which helps customers to migrate their databases in easy and quick way. Following example shows step by step process of migrating “Northwind” database from on-premises Sql Server to SQL Azure server.
- Connect to on-premises sql server. Launch the Generate Scripts Wizard from the Northwind database in Object Explorer.
- For scripting out a full database, make sure that “Script for entire database & all database objects” options selected in “Choose Objects” page.
- Go to the “Set Scripting Options page”. Click the Advanced button for changing the scripting options. Change the “Script for database engine type” option to “SQL Azure Database”. Based on this selection some not applicable options will be disabled. Click OK to proceed.
- You can save the generated script in file or new query window.
- Click Next to finish the scripting.
Use SSMS to connect to SQL Azure server (master database). Create database called “Northwind”.
Execute the previously generated script in the context of “Northwind” database.
. Object Explorer Details:
Object Explorer Details, a component of SQL Server Management Studio, provides a tabular view of all the objects in the server and presents a user interface to manage them. You can launch the object explorer details by pressing “F7”.
Object Explore details feature is enabled even when connected to SQL Azure. You can also perform the bulk object scripting or bulk object deletion.
6. Basic dialogs support:
SSMS provides different set of dialogs and wizards to make the DBA job simpler. When connected to “SQL Azure”, following two dialogs are supported.
- Delete Dialog: You can use this dialog for dropping an object.
Go to the object you would like to delete in the object explorer and right click on that object. Click the ‘Delete’ in the context menu of this object. It launches the following dialog for object deletion.
- View Dependency Dialog: You can use this dialog for viewing the objects on which this depends and objects which are dependant on this object.
Go to the object you would like to view the dependencies in the object explorer and right click on that object. Click the ‘View Dependency’ in the context menu of this object. It launches the following view dependency dialog.
Templates are boilerplate files containing SQL scripts that help you create objects in the database. You can launch the “Template Explorer” by pressing the “Ctrl+ALT+T” or from selecting the “Template Explorer” option from view menu.
Template Explore also consists of “SQL Azure Database” templates. These can be used for creating objects in SQL Azure Database. You can find the SQL Azure Database templates under “SQL Azure Database” node in the Template Explorer.