K'Blog

Because there’s always more to learn

  Home  |   Contact  |   Syndication    |   Login
  10 Posts | 0 Stories | 2 Comments | 0 Trackbacks

News

Twitter





Archives

Post Categories

ASP.NET

Friday, September 26, 2008 #

Recently, in one project i need to get random records from sql server table and i found a good way to do that.

SELECT TOP <n> <column list> 
FROM <table>
WHERE <criteria>
ORDER BY NEWID()

The main function is NEWID() which return GUID.


Cheers !!
Krunal