Lesson 2 | Overview of inserting data |
Objective | Describe how to insert data with Transact-SQL. |
INSERT
Transact-SQL statement. With the INSERT
statement you can specify the names of specific columns with which to insert data, or you can insert data into all of the table columns.INSERT
statement uses the following general syntax:
IDENTITY
column, it protects these values by not allowing insert statements that contain IDENTITY
datatypes.
However, if you do wish to insert values into your IDENTITY
column, you can instruct SQL Server to allow this by issuing this Transact-SQL statement:
SET IDENTITY_INSERT table_name ON
IDENTITY
column. Remember, only one IDENTITY column can exist in a table. In the next lesson, you will get an overview of the UPDATE
statement,
which is used to update data in your tables.