Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mssql how to insert more than 1000 rows

BEGIN TRANSACTION; -- Whenever possible use transactions when dealing with large amounts of data
INSERT INTO [database].[dbo].[table_name] ([field1], [field2], [field3])
SELECT 'value for row 1 field 1', 'value for row 1 field 2', 'value for row 1 field 3' UNION ALL
SELECT 'value for row 2 field 1', 'value for row 2 field 2', 'value for row 2 field 3' UNION ALL
-- ...N-thousand other rows...
SELECT 'value for row n-1 field 1', 'value for row n-1 field 2', 'value for row n-1 field 3' UNION ALL
SELECT 'value for row n field 1', 'value for row n field 2', 'value for row n field 3'; -- No 'UNION ALL' statement on the last line
COMMIT TRANSACTION;
Comment

PREVIOUS NEXT
Code Example
Sql :: id increment ms sql server 
Sql :: postgresql allow remote connection 
Sql :: select amount weeks between two dates mysql 
Sql :: mysql - find in comma separated string of values 
Sql :: grant access on table in oracle 
Sql :: convert date to datetime sql 
Sql :: sqlserver docker 
Sql :: set column to not null mysql 
Sql :: clone table structure mysql 
Sql :: get ip from phpmyadmin 
Sql :: mysql remove duplicates 
Sql :: sql select sum group by id laravel join 
Sql :: list all the tables in sql 
Sql :: check if table exists oracle 
Sql :: how to add CHECK constraint to a column in postgres 
Sql :: mysql update row 
Sql :: where date = max(date) in sql 
Sql :: sql order by where condition 
Sql :: sql not equal multiple columns 
Sql :: spring datasource properties mysql 
Sql :: sql server select value large text 
Sql :: postgres statistics 
Sql :: trouver doublons sql 
Sql :: replace string value in sql 
Sql :: change auto increment mysql 
Sql :: create a view in sqlite 
Sql :: script sql backup database sql server 
Sql :: mysql multiple count 
Sql :: sql case 
Sql :: replace null in sql 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =