SQL Server 中没有For循环,可以使用while循环代替
CREATE PROCEDURE AddStudents AS
Begin
Declare @n bigint
Declare @Sql nvarchar(225)
set @n=0
while @n<10000
begin
Set @Sql='Insert into Students Values(''Hamunet'',10,''SianChina'',''123456789123'')'
Exec (@Sql)
set @n=@n+1
End
本文介绍了一种在SQL Server中使用While循环实现批量数据插入的方法。通过定义存储过程,设置循环条件并执行动态SQL语句,高效地完成大量数据的批量插入任务。
628

被折叠的 条评论
为什么被折叠?



