sql 语句批量插入数据
批量插入测试数据:
定义变量,执行循环,将Int转化为Varchar。例:convert(varchar(50),@num)
假设表Test(ID,Name,Password),批量插入1100000条数据
declare @Name varchar(50)
declare @Password varchar(50)
declare @num int
set @Password='123456'
set @num=1
while @num<1100000
begin
set @Name='test'+convert(varchar(50),@num);
insert into Test(Name,Password) values(@Name,@Password)
set @num=@num+1
end