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.