SQL Server Insert Multiple Rows in a Single Query | DbSchema



Let's suppose the next scenario. You have a country table with 2 columns (country_id, name) and you want to insert multiple sets of data. Instead of running multiple queries like:

 INSERT INTO country VALUES (1, 'Canada');
 INSERT INTO country VALUES (2, 'Argentina');
 INSERT INTO country VALUES (3, 'Mexico');
 INSERT INTO country VALUES (4, 'Spain');

You can run a single query that will insert multiple rows at once. The query looks like this:

INSERT INTO Table ( Column1, Column2 ) VALUES
( Value1, Value2 ), ( Value1, Value2 )

Transforming it to my country example:

DbSchema ER diagram designer DbSchema ER diagram designer

Design and visualize
your database schema

Edit referenced records
in related tables

Query your data
visually too

Reuse the SQL
generated

Free Download
INSERT INTO country ( country_id, name ) VALUES
(1, 'Canada'), 
(2, 'Argetina'),
(3, 'Mexico'),
(4, 'Spain');

DbSchema Design your database visually - free

DbSchema ER Diagram Download free
Visual Design & Schema Diagram

✓ Create and manage your database schema visually through a user-friendly graphical interface.

✓ Easily arrange tables, columns, and foreign keys to simplify complex database structures, ensuring clarity and accessibility.

GIT & Collaboration
Version Control & Collaboration

✓ Manage schema changes through version control with built-in Git integration, ensuring every update is tracked and backed up.

✓ Collaborate efficiently with your team to maintain data integrity and streamline your workflow for accurate, consistent results.

Data Explorer & Query Builder
Relational Data & Query Builder

✓ Seamlessly navigate and visually explore your database, inspecting tables and their relationships.

✓ Build complex SQL queries using an intuitive drag-and-drop interface, providing instant results for quick, actionable insights.

Interactive Documentation & Reporting
HTML5 Documentation & Reporting

✓ Generate HTML5 documentation that provides an interactive view of your database schema.

✓ Include comments for columns, use tags for better organization, and create visually reports.