真的真很麻烦你了,我都不好意思了.
declare @max int
declare @id varchar
declare cur_rows cursor local for select 出口规格,count(*) from 轧硬卷 group by 出口规格 having count(*) > 1
open cur_rows
fetch cur_rows into @id,@max
while @@fetch_status=0
begin
select @max = @max -1
set rowcount @max
insert into 表1 values(@id,@max,)
delete from 轧硬卷 where 出口规格 = @id
fetch cur_rows into @id,@max
end
close cur_rows
set rowcount 0
这个方法可以统计,也可以插入,就是插入到表1中,那列中(规格)的内容全是"0",不知道哪错了.
declare @max int
declare @id varchar
declare cur_rows cursor local for select 出口规格,count(*) from 轧硬卷 group by 出口规格 having count(*) > 1
open cur_rows
fetch cur_rows into @id,@max
while @@fetch_status=0
begin
select @max = @max -1
set rowcount @max
insert into 表1 values(@id,@max,)
delete from 轧硬卷 where 出口规格 = @id
fetch cur_rows into @id,@max
end
close cur_rows
set rowcount 0
这个方法可以统计,也可以插入,就是插入到表1中,那列中(规格)的内容全是"0",不知道哪错了.