Looping through 1 million data in SQL Server 2000

Source: Internet
Author: User
Tags insert
server| Insert | data | loop

Source: Tomorrow go begging ' s Blog

The previous time in testing more than 1 million data paging speed, need to insert 1 million records into the database, at that time inserted record I was written in C #, and later found that, in fact, with the SQL can also be achieved, and more simple Oh! Here is an example I wrote, very simple, we should be able to read.

DECLARE @i INT--Variable semantics @i
Set @i = 1--Initialize @i to 1
While @i < 100--if @i is less than 100, this is changed to 1 million to insert 1 million records
Begin------------------
INSERT INTO Manager (USERNAME,USERPWD) VALUES (' Kgdiwss ', ' 250 ')
Set @i = @i + 1
End--------------------

How, very simple, in fact, the function of SQL is also very powerful, a lot of things it can be done. I used to judge a lot of things in the program, and now I'm used to the SQL, because it can be easily modified.



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.