Most common statement used in the SQL Server application is the INSERT statement. An SQL Server Insert statement is a command statement that adds one or more records to any single table in a relational database. This means grouping together data set having common attributes. For example is a data set of all the fourth year high school students in a particular school can be grouped by age, by gender, or by race and so on.
SQL Server has Insert Statement that allows users to add new rows to an SQL table. Based on example earlier presented, the school registrar may insert a new row if a new student in the fourth year high school class has enrolled.
The basic format for an Insert statement is an INSERT INTO table (column1, [column2, … ]) VALUES (value1, [value2, …]). The number of the columns and values should be the same. If the column is not specified, the default value for the column is used. The values as specified (or implied) by the INSERT statement should satisfy all the applicable constraints to include the primary keys, CHECK constraints, and NOT NULL constraints. If a syntax error appears or if the constraints are violated, the new row is not added to the table and an error returned pops up. Another Insert statement is called the Multirow inserts. Multirow inserts makes use of row value constructors to insert multiple rows at a time in a single SQL statement.
The SQL Server Insert statement also allows user to retrieve data from other tables, modify it if necessary and insert it directly into the table. This is done in a single SQL statement, which does not require intermediary processing in the client application. A subselect usually an asterisk is used instead of the VALUES clause.