HOW TO SELECTE RANDOM RECORDS FROM SQL SERVER TABLE?

Tanuj Kumar

Total Post:134

Points:940
Posted by  Tanuj Kumar
 1797  View(s)
Ratings:
Rate this:
Hello Everyone,
I want to select records randomly from my SQL Server table. Could you explain it with the code that how to do it?

Thanks in advance!!
  1. Arun Singh

    Post:68

    Points:476
    Re: How to selecte random records from SQL Server table?

    Hi Tanuj Kumar,
    In SQL Server database, there is a function NEWID() through which we can select SQL table record randomly.
    Query: select * from tbl_Name order by newid()

    I hope it might be resolve your problem.




Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!