How to select random records in SQl Server

No.of Views1283
Bookmarked0 times
Downloads 
Votes0
By  RRaveen   On  15 Feb 2010 22:02:47
Tag : Sql Servers , T-SQL
How to select random records in SQl Server
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 Hi Guys,

Most of the developers, asking in forums how to select random records from the database in Sql Server.

Here script:

SELECT TOP 5 employeeID, FName,LName from Employee
ORDER BY NEWID();



Thank you
RRaveen
Keep looking
 
Sign Up to vote for this article
 
About Author
 
RRaveen
Occupation-Software Engineer
Company-TGS
Member Type-Gold
Location-Singapore
Joined date-03 Jun 2009
Home Page-codegain.com
Blog Page-www.codegain.com
- B.Sc. degree in Computer Science. - 4+ years experience in Visual C#.net and VB.net - Obsessed in OOP style design and programming. - Designing and developing Network security tools. - Designing and developing a client/server application for sharing files among users in a way other than FTP protocol. - Designing and implementing GSM gateway applications and bulk messaging. - Windows Mobile and Symbian Programming - Having knowledge with ERP solutions
 
 
Other popularSectionarticles
Comments
By:DougDate Of Posted:6/3/2011 12:13:15 PM
Thank you
I'm not sure if I ever would have figured this out. without using location.host i was getting repeated "Permission Denied" and "Object Expected" errors. This fix did away with them all.
By:E.Date Of Posted:12/17/2010 6:12:20 AM
Super
wow this really helped me out! Thanks a lot.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top