Share via


Exercise 1: Creating a new Database in SQL Azure

Task 1 – Connecting to SQL Azure and Creating a Database

  1. Open SQL Server Management Studio. Start > All Programs > SQL Server 2008 R2 November CTP > SQL Server Management Studio. You will be presented with a logon dialog.

    Figure 1

    SQL Server Management Studio Default Connection Dialog

  2. Enter your login information ensuring that you selected SQL Server Authentication. SQL Azure currently only supports SQL Server Authentication. Click on the Options tab, and specify the database to connect to as master. Click Connect.

    Note:
    Please replace server name with your assigned server, i.e. REPLACE_SERVER_NAME.database.windows.net

    Figure 2

    Connecting to SQL Azure

    Figure 3

    Connect to master database

  3. You should now see in your ObjectExplorer the structure of your database. Notice that your SQL Azure database is no different to an on premise relational database.

    Figure 4

    The Object Explorer

  4. Click the New Query button. This will open a similar dialog requesting logon information.

    Figure 5

    Creating a New Query Window

  5. You now have a query window with an active connection to your account.You will now create a new Database. One of the good things about SQL Azure is that it takes care of much of the management of our database for us including how to manage the underlying data files. This means that our Create Database statement can be very simple. Type Create Database Customers and click Execute

    Figure 6

    Creating a New Database

    Note:
    You can select which SQL Azure Database edition (Web or Business) is created during the database provisioning process. This is surfaced both in the SQL Azure Portal and in the T-SQL Create Database statement. For example, to create a Business Edition database the T-SQL command would be as follows: CREATE DATABASE HolTestDB (MAXSIZE = 10GB). Once a database has been created, the database size will not be able to be changed.