Adding a Row into a table in SQL Server

In this tutorial, we will Learn how to add a single row / multiple rows into a table in SQL server. To add the rows, we will be using the Insert Statement.

Insert row syntax

The simplified syntax of adding a new row into sql server is as follows.

The statement starts with INSERT INTO.

table_name : The table in which the we are going to insert a row. We can use the Fully Qualified table name here.

column_list: The list of columns separated by comma.

If we skip a column then the SQL server inserts the default value ( or null if default value is not specified). If the column does not allow null value and default value is also not specified, then the Server will throw an error

VALUES clause follows the column_list

value_list The values to insert. Each value is separated by a comma and must match the order of the fields in the column_list.

Add Row Example

Create a new database HR

Select the HR database

Create a new table Employee

Insert a new row to employee table. Enclose the string in single quotes.

Use select query to view the inserted data

Add Multiple Rows

To add multiple rows, use the following syntax.

Reference

Insert TSQL

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top