A few weeks back Microsoft announced the first CTP of SQL Azure, its new cloud relational persistence offering. In this post I will show you how you can connect and query your SQL Azure DBs from your PC. There are two ways you can interact with SQL Azure, one is through the SQLCMD command line program and the other is through SQL Server Management studio. To connect to SQL Azure using the later, you need to follow these simple steps:
- Procure an activation code for SQL Azure (Since it is in CTP now). http://connect.microsoft.com
- Go to http://lx.azure.microsoft.com/ and activate you key. Then you can access SQL Azure from the portal (https://sql.azure.com) and create or drop databases, find out the connection strings and so on.
- To access the SQL Azure from SQL management studio, open the SQL Management studio 2008
- Cancel the login dialog box that will pop up
- Click on 'New Query'
- Choose Database engine as the server type
- Enter the server name of the SQL Azure server. This information can be obtained from the SQL Azure portal. (no prefix, no suffix, no protocol should be appended).
- Enter the login name (<login_name>@servername)
- Enter password
- Click on Options
- Enter the database name (master or another other database if you have created one). If you don’t you won’t be able to switch later (“USE” statement is not supported).
- Specify the TCP protocol
- Click on connect to connect
After that you’ll be able to run your SQL commands against you cloud SQL server.