SQL Insert Statement

SQL Insert Statement

Hi friends, in this post we will learn about SQL Insert Statement or you can say Insert Query to insert data into SQL server tables. SQL Insert Statement are used to add new data rows into table.

Earlier we had discussed about Drop Table SQL ServerRename Table in SQL ServerCreate Table SQL ServerSchema In SQL ServerSQL Server OperatorsData Type in SQL Server and Drop-Delete SQL Server Database Using Management Studio or Query.

We can insert data rows into table by three ways:

SQL Server Insert Into Statement:

----USE DATABASE IN WHICH WE WANT TO INSERT DATA----
USE Hightechnology
GO

----INSERT DATA INTO TABLE----
INSERT INTO STUDENT_INFORMATION(ID,NAME,CLASS,PERMADDRESS) VALUES(2,'JAI','X','DELHI')

SQL Server Insert Into Management Studio:

1. Open SQL Server Management Studio, and connect to SQL Server.

2. Expand Database name > Right click on table, in which you want to insert data and click on Edit Rows.

SQL Insert Statement

3. It will open table in editable mode, now we can insert data into columns. Once insertion complete. Close the query window.

 sql server insert into query

Insert Data from one table to another table:

----USE DATABASE IN WHICH WE WANT TO INSERT DATA INTO TABLE----
USE Hightechnology
GO
----INSERT DATA FROM ONE TABLE TO ANOTHER TABLE----
INSERT INTO STUDENT[(ID,NAME,CLASS,PERMADDRESS ,TEMPADDRESS )] 

----SELECT DATA FROM OLD STUDENT TABLE----
SELECT ID,NAME,CLASS,PERMADDRESS ,TEMPADDRESS FROM STUDENT_OLD
[WHERE condition];