Create a Database in SQL Azure

26. October 2010 06:28 by Mrojas in General  //  Tags: , , , , , ,   //   Comments (0)

One of the first steps to put your database in Windows Azure is to put your data on the cloud.

1. The first step is to log in to Azure

1.a) Go to 

1.b)Type your user name and password.

1.c) When your are logged in go to SQL Azure option on the left hand menu.

1.d) You will see a list of your projects. Click on the project.


2. You must accept Azure Terms of Use


3. Now create a server. You must indicate an administrator username and password. Azure will set the server name.
Press the Create Server button and continue.


4. Now let’s create a new database.Press the Create Database Button


5. Just type your database name, edition and size. Editions can be Web or Business.
At this moment Size for Web Edition is 1GB or 5GB and for Business is 10GB, 20GB, 30GB, 40GB and 50GB.
Prices varies according to the options that you select.
For my purposes I will select a Web Edition of 1GB


6. You should be able to see your new database in the Databases list.


7. Configure Firewall settings so you can connect to the new database.


7.1 Press the Allow Microsoft Services access to this server checkbox.
That will add a Rule Name that allows access from to
Select the rule and press Edit. You must can type something like to to allow access to all IP Address.

Moving your data to SQL Azure

The easiest way to upload a SQL Server database to SQL Azure is to use
the SQL Azure Migration Wizard this is a great tool that you can download from

1. Download the tool. In my case I installed it in D:\SQLAzureTools. Run SQLAzureMW.exe


2. Select SQL Database and press Next


3. Select your database and press connect. That will add your database to a list. Click on your database name and press Next


4. Select the tables and other object that you will move to your SQL Azure database


5. Press Next a Summary is presented with all options





6. The wizard will generate a BCP file and a script for your tables.


You can connect to run your scripts with the following command:

> sqlcmd -S tcp:<servername> -U <username>@<servername> -P <password> –d <database>

Depending on your configuration you might have problems with BCP. In general you need something like:

To export data:

bcp PhoneBook out c:\temp\Phonebook-c.dat –S <Server> –T –c

-T  means a trusted connection and native format

To import data

bcp Phonebook.dbo.Phonebook in c:\temp\Phonebook-c.dat -c -U <username>@<servername> -P <Password> -S tcp:<servername> -c







After importing your data, you are set to keep on developing your applications on Azure


If you dont know the schema name connect to your database and run something like:

SELECT '['+SCHEMA_NAME(schema_id)+'].['+name+']' AS SchemaTable FROM sys.tables