表是5字段int类型,第一个字段是主健,自增字段
表结构:
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<[email protected])
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
时间: 2024-10-14 00:33:38