当前位置: 代码迷 >> Sql Server >> 随机取数代码,该如何处理
  详细解决方案

随机取数代码,该如何处理

热度:77   发布时间:2016-04-27 17:57:57.0
随机取数代码
[email protected]代码是?
请教!


------解决方案--------------------
declare @k int
declare @tab table (RndNum int)
declare @i int
set @i = 1
while @i < 15
begin
insert into @tab(RndNum) select @i
set @i = @i + 1
end
set @k = (select top 1 RndNum from @tab order by newid())
print @k
  相关解决方案