Backend

Batch Insert Records

If you need to insert multiple records at the same time. Writing out those SQL insert queries can be laborious. Setting the same fields and then amending the values.

USE [ExampleDatabase]; INSERT INTO Employee (FirstName, LastName) VALUES ('Joe', 'Bloggs'); INSERT INTO Employee (FirstName, LastName) VALUES ('Jane', 'Bloggs'); INSERT INTO Employee (FirstName, LastName) VALUES ('Peter', 'Bloggs'); INSERT INTO Employee (FirstName, LastName) VALUES ('Mary', 'Bloggs'); INSERT INTO Employee (FirstName, LastName) VALUES ('Paul', 'Bloggs'); INSERT INTO Employee (FirstName, LastName) VALUES ('Lisa', 'Bloggs');
Code language: SQL (Structured Query Language) (sql)

You can batch insert several records with one INSERT command and add new values on each line as many you like.

USE [ExampleDatabase]; INSERT INTO Employee (FirstName, LastName) VALUES ('Joe', 'Bloggs'), ('Jane', 'Bloggs'), ('Peter', 'Bloggs'), ('Mary', 'Bloggs'), ('Paul', 'Bloggs'), ('Lisa', 'Bloggs');
Code language: SQL (Structured Query Language) (sql)