那就用个存储过程把.
create proc
as
declare @mystart int
declare @myend int
set @mystart=1 '开始的数值
set @myend=100 '结束的数值
while @mystart<@myend
begin
insert into ToTable(a,b) select a,@mystart from FromTable
set @mystart=@mystart+1
end
GO
当然也可以根据情况把INT的参数变成VARCHAR或者其他...如果是离散的没有规律的变量比如'111','abcd','3sd',这种存储过程就不好用了,我的做法是写个ASP或者其他程序,用COMMAND对象传个参数给存储过程插入.没想到什么好办法.