Here is the quick and easy way to select random rows in sql server.
SELECT <columns Name> FROM <table name> ORDER BY NewID()
Reference from : Brian Jeremy
......
Hope it will help you.
Thanks
Solomon S.
If information is helpfull then don't forget to post comments
3 comments:
I don't know whether this (function rand() OR random()) exists in SQL SEVER or not. But in MySQL there is a simple way to get random records from one table.
EXAMPLE
----------
SELECT *
FROM table_name
ORDER BY RAND()
LIMIT 10;
Hi Manmath Baral, Yes in MySQL it's RAND() and in MSSQL it is NewID() their is no function called RAND().
Post a Comment