Home >Database >Mysql Tutorial >小技巧 SQL execution loop

小技巧 SQL execution loop

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:47:391047browse

我们做测试的时候通常需要连续执行很多条相同的语句,我以前一直是通过While循环去做的,但是有一个更简单的办法,只需要用Go就可以实现了。 代码如下: use DBA go create table test ( name varchar ( 10 )) on [group] go insert into test values ( 'all

我们做测试的时候通常需要连续执行很多条相同的语句,我以前一直是通过While循环去做的,但是有一个更简单的办法,只需要用Go就可以实现了。

 

代码如下:

 

use DBA

go

create table test(name varchar(10)) on [group]

go

insert into test values ('allen')

go 1000

  

显示结果:

Beginning execution loop

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

 

。。。。。。。。。

最后是1000行生效,证明数据已经被保存到表里了,方便吧。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn