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
KH
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
Hover
As you say you are new to TSQL its better to refer to Ken Henderson’s book on TSQL http://www.amazon.co.uk/Gurus-Guide-Server-Stored-Procedures/dp/0201700468] fyi. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
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.
]]>