Daily Archives: Feb 27, 2016


Insert statement

In this chapter “Insert statement“, we are going to discuss T-SQL’s Insert statement which is used to add new records in a table. Whenever, we need to add a record in a table, INSERT T-SQL statement is used. We can insert single or multiple records at a time using INSERT statement. INSERT statement can be used in two ways as below:

  1. To insert fixed (hard-code) values
  2. To insert the result of a SELECT statement

Let’s discuss each of them in more detail with the help of example.

To insert fixed (hard-code) values

To insert fixed values in the table, below is the syntax:

Syntax:

INSERT INTO [<schema-name>.]<table-name>

[(column-1, column-2, column-3, …….., column-n)]

VALUES

(value-1, value-2, value-3, …….., value-n)

Where,

INSERT INTO is used to declare a new INSERT statement.

[<schema-name>.] is the name of the schema in which the table exists and is optional if the object exists … More