How To Execute SQL Query in SQL Server Management Studio(SSMS)

Today we will study to run SQL Script in SQL Server Management Studio.So we will open SQL Server Management Studio (SSMS) installed in our computer.I will explain How To Open SSMS. You can type SQL Server Management Studio in your computer search box and click on SQL Server Management Studio option as shown in below picture

How To Run SQL Script in SQL Server Database Using SQL Server Management Studio SSMS www.upsumdiary.com

Now you will get a window as Shown below

How To Run SQL Script in SQL Server Database Using SQL Server Management Studio SSMS www.upsumdiary.com

If we check above picture ,we can understand that

Server Name : DESKTOP-AEGCR6Q\SQL2008

DESKTOP-AEGCR6Q is my computer name and SQL2008 is the instance name on which I installed MS SQL Server

Authentication : Windows Authentication

Then I clicked on Connect button.

Now i got a window as shown below .

How To Run SQL Script in SQL Server Database Using SQL Server Management Studio SSMS www.upsumdiary.com

As shown in the above picture ,We will click on New Query option

Then I will select my database Upsumdiary from drop down list as shown in the below picture

How To Run SQL Script in SQL Server Database Using SQL Server Management Studio SSMS www.upsumdiary.com

Now we are going to create Customer table ,insert values to Customer table and Select values from Customer table.let us write SQL Query for Create ,Insert and Select operations and Click Execute button as show in below pictures

create table Customer(
Id int,
Name varchar(20),
City varchar(20))
How To Run SQL Script in SQL Server Database Using SQL Server Management Studio SSMS www.upsumdiary.com


insert into Customer(Id,Name,City) Values
(1,'Tom','Texas')
insert into Customer(Id,Name,City) Values
(2,'Mary','NewYork')
How To Run SQL Script in SQL Server Database Using SQL Server Management Studio SSMS www.upsumdiary.com

select * from Customer
How To Run SQL Script in SQL Server Database Using SQL Server Management Studio SSMS www.upsumdiary.com

Now It is your time to check it in your SQL Server database and please comment your experience.

Leave a Reply

Your email address will not be published. Required fields are marked *