Home > SQL Azure > Connect SQL Azure using SSMS

Connect SQL Azure using SSMS


We can use SQL Server Management Studio (SSMS) 2012 to connect with SQL Azure. You can also execute DDL, DML, DCL and TCL commands here.

In this blog post, I will be showing you how to connect and work with SQL Azure using SSMS 2012.

This example show you how connect SQL Azure using SSMS 2012 and run select query for an existing table.

Implementation

Step 1: Open SSMS and connect to SQL Azure

pic1Step 2: Select Database from the object explorer

pic2

Step 3: Open new Query window and write select query for table Location from SQLServerRider database

pic3

We have seen how to query a table from SQL Azure database using SSMS. SSMS is not a sophisticated place to work with SQL Azure database. Because, You have to write SQL query for each task.

Now, I will show you how to create a Database and  Table in SQL Azure.

Create a Database:

SSMS provides Query template for this task. Let me show you have to create a new database.

Step 1: Right click on the Databases node and click new database…

pic4

Your query window will have a database creation script template by default. So, you can just give the database name and run the query.

pic5CREATE DATABASE BlogReaders
GO

pic6You have successfully create a database in SQL Azure.

Create a Table:

Step 1: Right Click on the database BlogReaders->Tables and select new table.

pic7You will have table creation script in the new query window.

Note: You should have a Primary key column in each table in SQL Azure.

pic8Now, you can fill necessary values in the template and execute the query

pic9SQL Query:
IF OBJECT_ID(‘tblNames’, ‘U’) IS NOT NULL
DROP TABLE tblNames
GO
CREATE TABLE tblNames
(
NameID int,
strNames char(10),
CONSTRAINT PK_NameID PRIMARY KEY (NameID)
)
GO

We have created a table successfully.

pic10SSMS is an alternative way to work with SQL Azure database.

Advertisements
Categories: SQL Azure Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: