7 Z+ K& `4 s& |/ m0 l解决方案:! w% @; G* I. y% n
* t" r- l2 V4 b4 E
) w# @1 H# w4 F2 h- p# q L ( F$ A5 Y; [2 E5 ^, g- z% p select top 10 percent * from [yourtable] order by newid()" B1 o( v: F8 U6 W h, g
为了回应有关大型表的“纯垃圾”注释:您可以这样做来提高性能。- W3 e& R' U" P' Y/ r2 W7 S
select * from [yourtable] where [yourPk] in : W+ U7 I( s! I+ M(select top 10 percent [yourPk] from [yourtable] order by newid())8 t* ?4 s$ j2 c
此操作的成本将是对值进行加键扫描,再加上联接成本,在较大的表上选择较小的百分比应该是合理的。