时间:2021-07-01 10:21:17 帮助过:41人阅读
表结构:
id int Unchecked
billno bigint Unchecked
opid int Checked
billopid int Checked
tag int Checked
存储过程:
CREATE proc [dbo].[inbill]
@bills bigint,
@bille bigint,
@billopid int,
@result int output,
@incount int output
as
begin
set @result = (select COUNT(*) from bill where billno >= @bills and billno<=@bille)
set @incount = 0
if @result = 0
begin
while @bills + @incount <= @bille
begin
insert into bill (billno,billopid) values (@bills + @incount,@billopid)
set @incount = @incount + 1
end
end
end
SQL SERVER 2008 R2 插入数据非常慢
标签:自增字段 creat 自增 res values pid proc where while