Evgeny Garaev (9/18/2012)
Percentage is very low for that sample data, it will likely never return any row. Change the query like that to be fair:create table #Test (ID int primary key);
insert into #Test values (2);
insert into #Test values (1);
select top 1 ID from #Test tablesample (50 percent)
drop table #Test
I could have used 50 percent, but the correct answers would be the same. Now the query will return a single row approximately 10% of the times the code is run.