Monday, December 28, 2009

Sql Azure

I search for something in the sql server at that i found one article about the sql azure .

Thanks to "Don Schlichting" he is creating such a wonderful article for the .net users. How to used sql Azure in the .net . After reading this i search about the sql azure and seeing in the sql azure site and create the database then table. After this i think that it is possible to connect the sql azure to sql server management studio???

For that here i describe steps by step for creating account,database and table in the sql azure.

1) First of all you have to go sql Azure . In that you have to login with your window live Id (If You don't have then create it.)

2) After login you have to redirect to invitation code page where you have to enter your 32 character invitation code. So you think how you can find your invitation code. So don't worry
for that you can see one "Note : If you do not have an invitation code, please go here to join our mailing list to receive one." so please click on the "Mailing list ".

3) After click on the link one new tab is open like "Complete Required Registration Information". So in this you can choose "Continue" button for the further processing.

4) So you redirect to register page and enter your detail for getting invitation code and the click on "Continue" button. So you can redirect on verification page.

5) In the verification page you have to see your email address which you enter in the register page. So Microsoft ask to you that verify your email address that is enter into register page is correct or not. Then click on "Continue" button and got the new screen with the display name

6) So enter you display name which you want then click on the "Finish Registration" button.

7) After Clicking Finish Button you redirect to another page "Sql Azure Registration". So fill up your detail and click on the "Submit" button.

8) After Submit button you got the confirmation page "Thanks for registering!".

What after this, please sign out in the Sql Azure and checking the your mail box which is your register in the registration form.If you can't get any mail within two days please post your query in the sql azure forum .

After doing this long process i got the long mail from the Microsoft about the sql azure in that they provide the sql azure link and the invitation code and some URL for references.

So i copy that invitation code and open the site and enter my windows live id and i redirect to invitation code page where you have to enter your 32 character invitation cod. After enter the invitation code you can see your account is now enabled.They display following detail.

After getting this screen you are now ready to create your own database so click on the project name so you can get the next screen. In that you have to provide server login detail like user name , password , server location and then submit this detail so you can get the next screen say "Server Administration".

In this above image you can see the Server Name, Administrator User Name, Server Location , your master database (which is by default create by sql azure for you) and fire wall setting.

So creating database, first of all you have to set "Firewall Setting" tab. After Clicking firewall you can see the three buttons Add, Edit and Delete Rule. So click on the add rule and so one pop up is open with add name , your ip range and your ip from which you access this sql azure database.So fill up all the detail and then click on submit button.

Now after doing above all the long steps you are now ready to create the database. you can create a database three way using sql azure site or sql server management studio or sqlcmd (using command).

A) Sql Azure :
-> For creating database using sql azure site you have to click on the "Database" tab.
So you can see the four button.
1) Connection String
-> After clicking this button one pop up is open and you get two Connection string
1) and 2) ODBC. So take which you want.
-> I select first one
-> e.g For this tutorial i used this connection string
(It is dummy so you can't used any where);Database=master;User
Trusted_Connection=False; Encrypt=True;

2) Test Connectivity
-> This button is used for test connectivity.
3) Create Database
-> After clicking this button one pop up is open.
-> Enter your database name select size of the database. Then click on "Create" button.

4) Drop Database
-> Used for drop the selected database.

B) SqlCmd :
-> go to run and type cmd then command propmt is open
-> Now type sqlcimd -S your_server_name -U username@servername -P
yourpassword -d master
Note :
->Your_server_name:Please remove "tcp:" which is given into the connection string
-> username@servername : Please add your server name which is given into your

e.g. sqlcimd -S -U myusername@servername -P
myPassword -d master and then eneter.

C:\Document and Settings\vipul>sqlcimd -S -U
myusername@servername -P myPassword -d master
1>create database OnlineExam1

So OnlineExam1 Database is created.

3) Sql Server Managment Studio :
-> I have sql server 2008.So go to run and type ssms (open sql server managment studio)
-> Now enter your server name,UserId and Password and then click on the connect and
ohhhhhhhhh you can get the error like Invalid object name......So What to do???

-> Click ok in the error window and cancle the connection window.Now once again click the
new query and now you can enter all the detail and now connect so it will
connect and you can see the "master" database in the avilabel database dropdown.
-> Now you are all the expert in the sql server so you can create the database and see the
effect same as we create the database in the sqlcmd.

So we can see the above steps for creating account in the sql azure ,database and how you can access that account in the different way.

One min................

When i connect once again in the sql server management studio and when i acess the my newly created database "Onlinexam1" and got the error...say you can't access the database i am afraid what happen....................

then i close my existing connection and the once again click on new query window and then click on "Option" Button. In that you can select in the Connect to database so they ask one whould you like to continue? so click on ok and enjoy because now you can access the "OnlineExam" database.