show-notice
hide-notice

Wednesday 21 August 2013

Select Record from database randomly based on time in sql server


Introduction:

Here i will explain Select Record from database randomly based on time in sql server

Description:

Previous article i will explain Transform multiple row values to 1 row values in sql server. now i will explain Select Record from database randomly based on time in sql server.

Query:

SELECT TOP 100 [Column_Name]
FROM [Table_Name]
WHERE [Column_Name] >= DATEADD(hour,-1,GETDATE());
ORDER BY NEWID()
This would get 100 records that were created within the last hour and they will be gathered randomly.

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com