You are on page 1of 31

Tutorial: How to Use SQL

Server Management Studio from Home

Steps:
1. Assess the Environment
2. Set up the Environment
3. Download Microsoft SQL Server Express Edition
4. Install Microsoft SQL Server Express Edition
5. Use the VPN Client to Connect to the CIDM Domain
6. Connect to the CIDM SQL Server Instance and Test

Step One: Assess the Environment


One of the most important things to do before you begin installing SQL Server Management Studio is
checking to see if your computer is running a 32-bit or 64-bit Operating System. You can do this by
following the instructions below:
1. Go to the Start button at the bottom left side of your screen if you are using Windows XP. If
you are using Windows 7 or Windows Vista click on the ribbon
at the bottom left part of
your screen.
2. Right click on My Computer and click on Properties.
3. Under Systems you should be able to see whether your operating system is 32 or 64-bit as
shown in the images below.
Note: if you are using Windows XP and under systems it does not say whether it is X86 or X64, chances
are it is X86 (X86 means 32 bit while X64 means 64 bit).

Windows 7 and Vista should look like this:

Windows XP should look like this:

Step Two: Set up the Environment


You need to have ATLEAST Microsoft.Net Framework 3.5 Sp1, Windows Installer 4.5 and Windows
Powershell 1.0 on your computer before installing Microsoft SQL Server 2008 Management Studio. You
can download and install the above mentioned by following the links below:
a) First download and install Windows Installer 4.5 by clicking on the link below:
http://go.microsoft.com/fwlink/?LinkId=123422
b) Next download and install Microsoft .Net Framework 3.5 SP1 by clicking on the link below:
http://go.microsoft.com/fwlink/?LinkId=120550
c) Lastly, download and install Windows PowerShell 1.0 by clicking on the link below:
http://go.microsoft.com/fwlink/?LinkId=120552

Step Three: Downloading Microsoft SQL


Server Express Edition
1. To download Microsoft SQL Server 2008 Management Studio, go to the Microsoft website by
clicking on this link: http://www.microsoft.com/sqlserver/en/us/editions/express.aspx
2. On the right hand side of the page you will get an option to select the type of SQL Server Express
you want to download i.e. 32bit or 64bit; with or without tools as shown in figure 3.1

3. Select 32bit or 62bit depending on the kind of operating system that you have(if you do not
know how many bit your operating system is please refer to Assess the Environment in Step
One above). Also, make sure you select SQL Express with tools i.e. W/TOOLS. So for example if
you have a 32bit XP computer than you would download 2008 R2 32-BIT DATABASE W/TOOLS.
4. On the next page click on the Download Now button.

5. Save the executable file to your hard drive.

Step Four: Installing Microsoft SQL


Server Express Edition
1. Double click on the executable file that you just downloaded and you will see the following
screen:

2. Click on Installation link on the left hand corner of the screen and you should see the following
screen:

3. On the next screen read the contract and check I accept the license terms and click next.

4. Make sure all the features are select as shown in the image below and click next :

5. On the next screen select the Default Instance radio button then click next as shown below:

6. On the next screen select NT AUTHORITY\NETWORK SERVICE for the SQL Server Database
Engine Service and click next as shown below:

7. On the next screen select the Mixed Mode (SQL Server authentication and Windows
authentication) radio button and enter a new password that you will easily remember. Then
click next as shown below:

8. On the next page you may choose to send windows error reports if you wish to, this is not
mandatory, you can choose to check or uncheck the checkbox and then click next as shown
below:

9. SQL Server will begin to install at this point. Once SQL Server has been installed successfully you
will see a screen similar to the one below:

10. Click Close

Step Five: Download the VPN Client and


Connect to the CIS Domain
1. Click on the link: https://connect.wtamu.edu/+CSCOE+/logon.html . You should see the screen
below:

2. Enter your student username and password i.e. this is the same as the credentials you use to
access WTCLASS.

3. If you are using Windows 7 or Windows Vista the security warning like the one below should
show up, click Allow

4. The client should download automatically, but if it does not, click on the Download button.
5. If the client was downloaded successfully you should see a
sign at the bottom right
corner of your screen (on the tray). You should also see a screen similar to the one below:

Step Six: Connecting to the Server and


Test
1. Once SQL server has been installed successfully start it up by going to Start > All Programs >
Microsoft SQL Server 2008 R2 > SQL Server Management Studio. You should see a screen similar
to the one below:

2. To connect to the server:


a) Select Database Engine for the Server Type.
b) Type WTCIS-STUDB.cis.wtamu.edu\CIDM3350SP2012 for
the Server Name.
c) Select SQL Server Authentication for Authentication.
d) The login is your first initial and your last name together. So, if your name is John Doe then your
login will be jdoe. The password is the same as the one you set at your first login.

The screen should look similar to the one below but with your login and password:

3. Once you are logged in you should see a screen similar to the one below:

4. Click on Databases and you should see all the available databases.

5. Look for the database with your name and click on the plus sign next to it:

6. Click on the plus sign next to Tables to view the all the tables you have, at this point you
should have non as shown in the picture below:

Writing and Executing SQL Commands


1. To execute a query, right click on the schema that has your name on it and select New Query:

2. You should see a white space in the middle of the screen as shown below:

3. You can now type SQL statements in the area provided in the middle. After putting in your SQL
statements highlight it, right click on the highlighted part and click Execute

Examples:
Below are examples that show you how to Create a table, Alter a table, Insert Into a table, Delete from a
table and Drop a table.
a. Create Table
create Table test_student
(
S_ID int NOT NULL,
Fname varchar(250),
Lname varchar(250),
addresses varchar(250),
)

b. Add Primary Key


ALTER TABLE test_student
ADD PRIMARY KEY (S_ID)

c. Insert Data
INSERT INTO test_student(S_ID,Fname,Lname,addresses)
VALUES (1,'John','Doe','79015')

d. Select Data
Select * FROM test_student WHERE S_ID = 1