Random record from table in MSSQL database
We can get random records from MSSQL tables by using
and NEWID() functions. Here is the SQL to get one random record each time the query is executed.
select top 1 * from member order by NEWID()
To get more than one ( say 3 ) records here is the query.
select top 3 * from member order by NEWID()
MSSQL Query Examples
SELECT query in collecting records from MSSQL table
TOP with SELECT query to collect number of records
SELECT query with AND OR NOT for MSSQL table
SELECT query with LIKE using wildcards % and _
Count: Counting total records in MSSQL table
Group By: SQL command in MSSQL table
Different Date & Time formats by using Convert in SELECT query
DROP table to delete table from database with IF EXISTS
DELETE records from table by using WHERE condition
Getting random records by using TOP and NEWID() in MSSQL table
This is for short comments only. Use the
for more discussions.
( not to be displayed)
This is to prevent automatic submission by spammers. Please enter the result of the sum as asked
Join Our Email List
you can trust
©2000-2014 plus2net.com All rights reserved worldwide