SQL Server Insert

Insert command is used to insert data into a table. SQL Server Insert is one of data manipulation language command. Used to modify the database objects. Strings and date values must be enclosed with single quoted marks.


insert into table_name
(coulmn1, column2) values(value1, value2)

Create table

CREATE TABLE [dbo].[emp](
[empname] [varchar](20) NULL,
[empno] [numeric](18, 0) NULL,
[job] [varchar](30) NULL,
[joindate] [date] NULL,
[salary] [money] NULL,
[deptno] [nchar](10) NULL,
[location] [nchar](10) NULL

Insert data into above created table ’emp’

insert into emp(empname, empno, job, joindate, salary, deptno, location)


Insert data by GUI method:
1). Open SQL Server Management Studio. Then, right click on table to insert data.

2) Click on Edit top 200 rows and enter the data.
Inserting Null values:
Null values can be inserted in two ways
1) Inserting null valus explicitly, we have to specify null in insert statement.

insert into emp

2) Inserting null values implicitly can be done by exact columns in the column list respect values in values list.

Powered by k2schools