Finding all records in last 5 seconds | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Finding all records in last 5 seconds

Hi Folks, I am new to sql programming,can sm one help me with writing a query to determine
records that were inserted in table in last 5 second

select *
from yourtable
where datecol >= dateadd(second, -5, getdate())
the datecol should store the date & time of when the record is inserted
Also it should be of <b>DATETIME</b> datatype [<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ />]<br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail
As you say you are new to TSQL its better to refer to Ken Henderson’s book on TSQL] fyi. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.