select top 10 * from tablename order by newid()
这个速度太慢了,要等半分钟。有没有快速点的办法。
表的主键是varchar类型的,主键是字符串而不是int
------解决方案--------------------
- SQL code
set nocount on--75151448行数据select count(*) from syscolumns a,syscolumns b,syscolumns c set statistics time on select top 10 * from(select a.name as name,left(b.name,10) as name1, checksum(newid()) as hash from syscolumns a,syscolumns b,syscolumns c )t where hash%100=0set statistics time offset nocount off