SQL Server > Table- Create, Read, Update, Delete (CRUD)

Insert sql statement in SQL Server

How to insert a new record into SQL Server database table using sql statement and UI?


To create a record into SQL Server database table, we use insert statement.

Assuming that we have MyDetails table whose structure is below.

Using SQL Script

INSERT INTO MyDetails
(FullName, City)
VALUES
('John Singh', 'New Delhi')

Execute the above query in the Query window by writing it into the Query Window and clicking on “! Execute” icon at the top-left. This will get one record inserted into the database. Here VALUES is the reserved keyword that is preceded by the column names to insert and appended with the value to insert into the respective columns.

Using SSMS (Sql Server Management Studio) menus

Right click the database table and select “Edit Top xxx Rows”

This brings the table in Edit mode, now write data for FullName and City column, do not try to write data into AutoId column as that is auto increment and is automatically filled by Sql Server.

 Views: 2141 | Post Order: 29



Write for us