Tuesday, October 26, 2010

To get random records from a table in Sql Server

With the help of newid() function, each time different records will be genertaed .
This is inbuilt function in sql Server.
Ex:

SELECT Top 5 [name], [salary]FROM [dbo].[dupemp] ORDER BY NEWID()

No comments:

Post a Comment