How SQL Server performs bulk inserts and bulk deletions

Source: Internet
Author: User
Tags bulk insert

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.