日期:2014-05-18 浏览次数:20405 次
declare @sql varchar(max) declare @i int set @i = 1 while @i <= 30 begin select @sql = isnull(@sql+' union all ','') + ' select * from r'+ltrim(@i) set @i = @i + 1 end print @sql exec(@sql)