SQL Azure Query Tool– Part 4–Hannsens SQL Azure Manager

Hannssens’ SQL Azure Manager is a lightweight tool for managing SQL Azure databases.

Its still in Alpha release since 25-Aug-2009 and built on .Net Framework 3.5 and available as ClickOnce installer from the below link


Step 1: Click “Run” to install the application and Run


Step 2: To login to SQL Azure server, specify the Server Name, Username and password and click on “Connect”


Step 3: In Main screen toolbar, you have the option to switch between databases, you can pick the database which you want to work


Based on the database you selected, the Object Explorer will be refreshed and display the Tables and Views, you can also use “Refresh” option in toolbar to manually refresh as well.


For Tables and View, you have the following 3 options available under Context menu

1. Select Top 100 Records

2. Select All Records

3. Delete the table


Step 4: You can write and run your queries on the Right Side Query pane, the results will be displayed in Grid format, There is no Text format support or messages pane, Error messages will be displayed as Message Popup


Step 5: To Create a new database, click “New Database” option in Toolbar and then specify the Database name and click “Ok”


Step 6: To delete a database, click “Delete Database” in toolbar and then click “Yes” to confirm


Missing Feature:

1. No Message Pane

2. No option to view / Modify or Create Stored Procedures / Functions / Triggers using User Interface


There are no new releases in last 2 years and  the code was not released to Code Plex or Source Forge, so I am not sure about the future releases of this product.

Its also unstable and crashes.

User Interface is lightweight and nice and fast. It would be good, if they continue the development or release the code under CodePlex or other Open Source community


SQL Azure Database Manager–Project Houston

In the Episode 3 of SQL Azure Query Tool, we will see how to use SQL Azure Database Manager 10.0 (Project Houston), which is part of Windows Azure Management Portal now

Step 1: Login to Windows Azure Portal (https://windows.azure.com/default.aspx ), select the SQL Azure Server and Database and click on “Manage”


Step 2: Accept the Terms and Conditions and data collection agreement and click “Ok” to connect


Step 3: Server name, database name and user name will be pre-populated, Please enter password and click “Connect” to login


Step 4: Start Page will display the database properties (Default Collation, Compatibility Level, Date Created and Read Only) and Server Edition and Version


Click on Left or Right Arrow near to Database Properties to Spin up to Resources view


Step 5: To Query data click on “New Query” in tool bar

New Query


Type the SQL query and click on “Execute” to run the query, you can Save the query as .SQL file for future use as well. Results of the query will be displayed in Bottom pane as Grid


Output Messages can be displayed in the “Message” tab


Step 6: To Create New Table – Click on “New Table” icon in toolbar


Enter the column name, select the data type, size, default value, Specify whether Identity, Required or Primary Key. Click on “+ Column” to add more columns. Once completed the design, click on “Save” to save the table.

Step 7: To add data click on Data View in toolbar


Click on “+ Row” to add rows and enters data. Click Save to store the data.


Step 8: Create New View: To create a new view, click on “New View” button in toolbar

Select Schema, Specify View Name and then type the SQL Query and click “Save”, After saving the query, you can click on “Data” to view the output from View


Step 9: Create New Stored Procedure: To create new Stored Procedure, click on “New Stored Procedure” button in toolbar

Select Schema, specify name of Stored Procedure and then click “New Paramter” or “+ Parameter” to add parameter

Specify the name of the parameter, select data type, specify size (if required), default value, whether output parameter or not

Then define the stored procedure body and click “Save”


Step 10: Execute Stored Procedure: Once saved, you can click “Run” and then specify parameter values and click “Execute”



Conclusion: SQL Azure Database Manager (Project Houston) is a light-weight Management Studio Express with limited functionality to create Table, Views and Stored Procedures and manage Data

Missing Features:

1. No option to define Synonyms

2. No option to define Functions / View functions

3. No option to create Logins

4. No option to create Users or Manage Permissions

5. No option to Import / Export data

I hope in the future versions, these missing features will be added to make it a full fledge and fully functional Database Manager.

I hope you all find this information useful.

How to access SQL Azure from anywhere or How to disable SQL Azure Firewall ?

After reading my previous post regarding SQL Azure firewall configuration, one of my friend asked Whether there is an easy way to provide access any IP Address, so that he don’t have to worry about not able to connect using 3G wireless card to connect to SQL Azure

Yes, there is an easy way to do that…

Login to SQL Azure Management Portal and select the subscription and the SQL Azure server for which you want to provide access and then click on “Firewall Rules


Click “Add”



Click “Ok” to save the Firewall rule

Now you should be able to access this SQL Azure server from anywhere in the world.

Note: Please be aware that by adding the above rule, the SQL Azure firewall is pretty much disabled effectively. Obviously this is not a recommended practice.

How to monitor SQL Azure Database Usage Cost on daily basis by yourself

SQL Azure provides us the following system view “sys.database_usage”to get the details of database quantity used per day

How to calculate Daily Cost Usage ?

   1:  /* How to calculate Daily Cost of DB Usage */
   3:  SELECT time, sku, quantity,  
   4:      CASE sku 
   5:          when 'Web' THEN Quantity * (9.99 / 30)
   6:          WHEN 'Business' THEN Quantity * (49.99 / 30)
   7:      END AS DailyCostofDB
   8:  FROM sys.database_usage order by time


How to calculate Monthly cost of Database Usage ?

   1:  /* How to calculate Monthly Cost of DB Usage */
   3:  SELECT CAST(datepart(yy, TIME) AS Varchar) + ' - ' + DateName(mm, TIME) [Billing Month], 
   4:      SKU, 
   5:                    SUM   (     CASE WHEN USAGE.SKU = 'Web'
   6:                                      THEN (Quantity * 9.99/30)
   7:                                 WHEN USAGE.SKU = 'Business'
   8:                                            THEN (Quantity * 99.99/30)
   9:                                END ) AS CostInDollars
  10:  FROM              sys.Database_Usage USAGE
  11:  GROUP BY    CAST(datepart(yy, TIME) AS Varchar) + ' - ' + DateName(mm, TIME), SKU
  12:  ORDER BY CAST(datepart(yy, TIME) AS Varchar) + ' - ' + DateName(mm, TIME)


You can use this queries in a SSIS Package to collect data from SQL Azure on daily basis and store it in local server and prepare reports across various different SQL Azure servers

I hope you all find this useful to monitor the cost of SQL Azure database usage

How to Configure SQL Azure Firewall using Queries

For connecting to SQL Azure, your IP Address should be added to SQL Azure Firewall, you can do this normally by SQL Azure Management Portal, but adding them one by one using Web Interface might be little difficult for SQL Azure Administrators

SQL Azure provides the following System Procedures to Manage SQL Azure Firewall policies

–To query the list of Active Firewall rules

SELECT * FROM sys.firewall_rules


To add a new IP Address or Range of IP Address to SQL Azure Firewall

–Query to Add or Update One or Range of IP Addresses to Firewall Policy

EXEC sys.sp_set_firewall_rule @name = N’Office’,
    @start_ip_address = ‘XXX.XXX.XXX.1’,
    @end_ip_address = ‘XXX.XXX.XXX.255’

–Query to Remove or Delete an IPAddress or IP Address Range from SQL Azure Firewall

EXEC sys.sp_delete_firewall_rule @name = N’Office’


If you look at the above screen shot, The policy with id 7 has been removed.

Using these System SPs, you can script your firewall policies and deploy them quickly on your new SQL Azure server, without having to use SQL Azure Management portal

%d bloggers like this: