Categories
Sql Server

How To Select Random Records In SQL Server

Hi Guys in this tutorial i will let you know, How To Select Random Records In SQL Server.This is very needful when we have to select some records from our database but randomly.We can achieve this by a function in SQL Server.

NEWID:

NEWID() generates the GUID in random order.Also The value returned by NEWID() is different for each computer.

Example:

  Select top 7 * from [problem_type_master] order by newid()

Result:

Select Random Records In SQL Server

One reply on “How To Select Random Records In SQL Server”

Lovely blog! I am loving it!! Will be back later to read some more. I am bookmarking your feeds also

Comments are closed.