Go to home page mail me! RSS Feed
FoxMetrics Web Analytics

SQL Server return random rows

Wednesday, January 14, 2009 4:31 PM

Here is a cool little script to return random rows from SQL Server but before you go running off, I must warn you, this will bring your response time to a crawl if you run it against a large table, say over 6 figure rows, therefore, you might want to come with a different way of doing random rows if you have a huge data set.

 select top 100 *

    from [TableName]
    order by newid()

Your Comments.

No comments posted yet.

Your Reply.

Comment Form.

Fields denoted with a "*" are required.

You may also like to leave your email or website.

 
Please add 1 and 4 and type the answer here:

Preview Your Comment.

 
Next entries »