I recently had the opportunity to get access to an internal CTP of the new SQL Azure technology which, at the time of this writing, should now be available as a public CTP.  Here is a link to the SQL Azure team post for information on how to get started.

SQL Azure, formerly known as SQL Services, is a new relational database in the cloud.  It is a specialized version of SQL Server 2008.  In fact, if you execute the command “select @@version”, you will get back a string that says as much:

One of the really neat things about SQL Azure is that you can connect to it using a SQL connection string, much like you would with an on-premise SQL Server.  This works because SQL Azure, much like its non-cloud cousins, comes with TDS support.

TDS stands for Tabular Data Stream and is an application-level protocol used in communication between client applications and SQL Server.  TDS packets are encapsulated in the packets built for the protocol stack.  So if you are using the TCP/IP Sockets Net-Library, then TDS packets are encapsulated in the TCP/IP packets.  Because of this, you can use a SQL connection string to connect to SQL Azure from even behind a firewall, provided your firewall settings are not blocking outbound ports.

Support for TDS means that you will eventually be able to use the same tools you use today when developing against SQL Server.  I say eventually because as of CTP1 of SQL Azure, there are still a few kinks to work out in order to enable full support for tools like SQL Server Management Studio (SSMS).  You can still use SSMS today against SQL Azure if you are aware of these kinks and how to work around some of them.

For the purposes of this post, I’m going to assume you’ve already signed up for the SQL Azure CTP.

Once you’ve gotten access to SQL Azure, you can navigate to the portal site and from there you can create a database from the Server administration page.


The master database will be the only database listed initially.  I should also mention that you can create a database using SQL as well.  As I’ve implied, support for tools is still in the works since this is only a CTP, however you can use sqlcmd and SSMS today to do much of what you need to do with SQL Azure.

The following is an example of the syntax you would use when connecting to SQL Azure using sqlcmd:


sqlcmd -S oup6wnx5kr.ctp.database.windows.net -U mpapas@oup6wnx5kr -P ***********


Connecting using SSMS is a bit trickier.  The following are the steps you need to take:

  1. Launch SSMS
  2. Cancel the initial “Connect to Server” dialog (support for the Object Explorer in SSMS is not there yet)
  3. Click on New Query

  4. You’ll need to specify SQL Server Authentication and specify the Server Name in the following format tcp:<your server name>.ctp.database.windows.net.  Be sure you have support for TCP/IP enabled as a client protocol.

  5. Don’t click Connect just yet.  Instead click on Options >>.
  6. If you’ve already created the database using the portal site, type in the name of the database in the Connect to Database combo box.  You won’t be able to see your database in the drop down because support for that just isn’t there yet either.

  7. Finally, click Connect.
  8. You will see the following dialog pop-up.  This is safe to ignore (more CTP goodness I guess).


And that’s all there is to it.  Now that you have a query window open, you can enter and execute your SQL.


You can even show the execution plan of your queries:


It’s important to mention that not all T-SQL is supported.  For a list of what is and is not supported, see the SQL Azure documentation on MSDN.

In an upcoming blog post, I plan on blogging about my experience with converting NerdDinner to use SQL Azure for its main database instead of Windows Azure Storage.


This posting represents the sole opinion of the author and is not the opinion of Microsoft Corporation.  This posting is provided "AS IS" with no warranties, and confers no rights.  Use of any included samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm.