I am familiar with MySQL, but not in MS SQL,
In MySQL, the query will look like this:
SELECT * from tablename ORDER BY RAND() LIMIT 5
The above query gives 5 random numbers from a table. The same query, how can I work with MS SQL?
Try
SELECT TOP 5 * from tablename ORDER BY NEWID()
Look at using TOP and order NEWID
Sort of
SELECT TOP 5 * FROM TableName ORDER BY NEWID()
It will be:
SELECT TOP 5 * FROM tablename ORDER BY NEWID()
Tested in MSSQL 2005.