Quantcast
Channel: Toad Data Point Forum - Recent Threads
Viewing all articles
Browse latest Browse all 2544

RE: Create a random sample of data from a view

$
0
0

Why don't you use SQL to do it for you?  Here are two methods that will give random results:

select top 5000 * from [tablename] where ... order by newid()
select * from [tablename] tablesample(5000 rows) where ...

The second one is faster if you are on SQL Sever 2005 and up.  You can also use %'s as in tablesample(5 percent) or top 5 percent.  You can find this on StackOverflow.com


Viewing all articles
Browse latest Browse all 2544

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>