34,590
社区成员
发帖
与我相关
我的任务
分享
declare @i int
set @i=0
while @i<=20
begin
print @i
set @i=@i+1
end
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
create table t_barcode(barcode int)
create table t_art(productid varchar(10))
go
insert t_art select '0001'
insert t_art select '0001'
insert t_art select '0001'
insert t_art select '0001'
insert t_art select '0001'
declare @i int
set @i=0
select px=identity(int,1,1) into # from t_art where productID='0001'
insert into t_barcode(barcode)
select px from #
select * from t_barcode
drop table t_barcode,t_art,#
/8
barcode
-----------
1
2
3
4
5
(所影响的行数为 5 行)
*/