Book Image

SQL Server 2014 Development Essentials

By : Basit A. Masood-Al-Farooq
Book Image

SQL Server 2014 Development Essentials

By: Basit A. Masood-Al-Farooq

Overview of this book

Table of Contents (14 chapters)
SQL Server 2014 Development Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Inserting data into SQL Server database tables


In SQL Server, you use the INSERT statement to add one new row or multiple new rows to an existing table. You can use the INSERT statement to insert data into a particular column, all columns, and IDENTITY columns.

To execute INSERT statements, a user must have at least the INSERT permission assigned on the target table.

The following is the basic syntax for INSERT statements:

[WITH <common_table_expression> [,...n]]
INSERT [TOP (expression) [PERCENT]
[INTO]
table_name | view_name | rowset function | common_table_expression
[WITH table_hints ]
<output_clause>
[(column_list)]
{VALUES (values_list) | select_statement | DEFAULT | execute_statement | dml_table_source
NULL
} | DEFAULT VALUES

The column_list parameter specifies a list of one or more columns in which you are inserting data. The column_list parameter is optional when you are providing a value for each column in the table, and the values appear in the exact order in which the...