Normally, our SQL Server executes the query statement by
Insert into table name (field name, field name) VALUES (insert value, insert value)
-- Single INSERT statement--- Insert into Values (' test ')
So how do you bulk insert it? Besides the combination of multiple INSERT statements, is there anything else?
--Bulk Add---for SQL Server--Mode 1: Multiple INSERT statements insert----Insert intoReader (Readername)Values('Reader 1');Insert intoReader (Readername)Values('Reader 2');Insert intoReader (Readername)Values('Reader 3');--mode 2:union all mode to insert---Insert intoReader (readername)Select 'Reader 4'Union AllSelect 'Reader 5'Union All Select 'Reader 6'--Way 3:sqlserver2008 The new insert syntax---Insert intoReader (readername)Values('Read 7'),('Read 8'),('Read 9')
After inserting the results are as follows:
So how to bulk delete what? We know that the delete syntax is like this
Delete from table name where condition
-- Delete a piece of data--- Delete from where readid=1- - Delete multiple data in bulk--Deletefromwhere in (2,3,4)
After deletion, the result is as follows:
How SQL Server performs bulk inserts and bulk deletions