一个查询 大家看看
select top 3 * from T_DisasembleMach order by newid()
这样可以查询出表里随机的3条记录
现在我想用变量来查询,可以有问题啊,大家看看下面:
declare @i int
set @i=3
select top @i * from T_DisasembleMach order by newid()
大哥哥们帮忙看看哦 谢谢
------解决方案--------------------declare @i int
set @i=3
declare @sql varchar(200)
set @sql= 'select top '+@i+ ' * from T_DisasembleMach order by newid() '
exec(@sql)