This is a brief introduction to the SQL server management studio.
For beginners, I will just cover the basic UI components and a few simple tasks that you can do.
Let us see how to connect to SQL Server Management Studio. The first thing that asks us to do is connect to the server.
SQL Management studio is a client tool. Its purpose is to allow us to submit comments and expects things that are on the server.
There is a limited amount of things that you can do without being connected.
How to connect to the Management Studio?
Here I am connecting to a database engine it’s on my local machine using window authentication.
You will authenticate using the credentials that your DBA is provided to you.
After I connected to “ SQL Server Management Studio” the first thing I can see on the left is the object explorer.
At the top of the tree structure you can see the server that I have connected to, which again is in my local machine.
Here we can see a number of folders. I can expand in or collapse these objects.
We can look at the tables where each table is an object that has many things in it.
If you want to see more detail we can double click on these columns and we can see the many attributes that apply to each of the columns.
Another thing that you can do is on the left-hand side in the object explorer select one of these objects and right-click on it and get the contact-sensitive menu that allows you to do the actions that are specific to the clicked on.
How to retrieve the results from a specific table in Management Studio?
I clicked on select top 1000 rows from the table dropdown window.
What this does for me is, it creates the script SQL select statement and it selects the top 1000 rows from the product table.
If we want to know how to create a table in SQL Server Management Studio you can check our other article “How to Create a Table in SQL”
What exactly happens here, It submits the script to the database server and the database server interprets the script executes.
It takes the results pane and sends back to SQL Management Studio and SQL server management studio displays it in the grid view.
So here we have the main components of UI. The objects explorer on the left side also we have a query window at the top.
Now I am in the database window of SQL Server Management Studio. If you can see on the Left-hand side menu it’s basically a query window and text editor.
What you can do is effectively have a script of commands in the window. Like if nothing is highlighted all the queries in that particular window will be executed.
How to create a table in SQL Server Management Studio?
Now let us see how to create a table in SQL Server Management Studio with practical example.
Let us consider “Study with Demo” as our sample database for table creation in SQL Server Management Studio
Open Management studio expands the study with a demo database select tables right-clicks on it as it shows in the below diagram
- Click on table enter column name first name datatype varchar and click checkbox remove null values.
- Enter the Last name as the second column and select the data type varchar 50 and click on the checkbox to remove null values.
- Set the First Name as the primary key to doing this see the below diagram.
To save the table just click on the close button on the page and give the name of the table as a student and click on ok then the table will be created successfully.
Save the newly created table as Students as shown in the below diagram.
Now expand the table using objects explorer
Click on the refresh option. You will see the newly created table.
Expand the table here you can see the column’s first name and last name.
How to enter the data in the table of SQL Server Management studio?
Right-click on the table and click on edit top 200 rows option.
Now let us enter two records as Faruk and Moien and then click on the close button to see the data.
Now we will see the saves data. Right-click on the table name select top 1000 rows.
Now we can see the newly entered two records under Student Table Columns.