我们做测试的时候通常需要连续执行很多条相同的语句,我以前一直是通过while循环去做的,但是有一个更简单的办法,只需要用go就可以实现了。
代码如下:
use dba
go
create table test(namevarchar(10))on [group]
go
insert into testvalues ('allen')
go 1000
显示结果:
beginning execution loop
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
。。。。。。。。。
最后是1000行生效,证明数据已经被保存到表里了,方便吧。