数据库版本 SQL Server 2008
如果需要往数据库中插入100万条记录,那个时候插入记录我是用C#写的,后来发现,其实用SQL自已也可以实现的,而且更简单效率更高!
看示例
create proc proc_Prvalue
as
declare @i int
set @i=1
while @i<=1000000
begin
insert into Products( Name, Price, Works, typeid) values('羽绒服','210','冬季必备',1)
set @i=@i+1
end
go
exec proc_Prvalue --调用
执行该存储过程,将在表 Products中 添加10W条数据,比在程序中写 循环要好很多哦!