Sql Azure first contact

28 Ott

Tonight I’m starting a new project. Porting to the cloud a real application running “on premises”.

The first step of this migration is the database. For the moment I want just to recreate the database schema. The data migration will be done in the future but since I hope the database schema will be the same I believe this step will be an easy task.

I have already setup my SqlAzure credential (there are many posts about it). If you want to connect using SSMS (SQL Server Managment Studio) this are the step you need to follow:

  1. Cancel the first connection dialog that pops up when you open SSMS.
  2. Click on the New Query button from the toolbar
  3. Enter your server name: eg. xxxyyyzzz.database.windows.net
  4. Enter your Login: username@xxxyyyzzz
  5. Hit connect.

This is my login prompt:

image

If you get this error: “Invalid object name ‘sys.configurations’” it’s because you didn’t cancel the first logon prompt.

Once you logged on you are ready to go. In my case I have 2 scripts: one for database creation and one for the creation of the database’s objects (tables & indexes).

image

The first it’s very very simple. Just the common CREATE DATABASE statement in order to create the db. No problem with that.

image

Now my database is up & running. I need a new connection to run the second script. It this connection I must set the database name in the options as shown below:

image

Unfortunately with the second I get some errors at the first run cause I’m using some SqlServer features that are not available on SqlAzure. Using the “Parse” button several times I can detect which features are not supported and than correct my script.

image

At the end my script pass and my database is ready to use.

In the next post I’ll try to migrate the web application (which is built with ASP.NET MVC V1)

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger cliccano Mi Piace per questo: