January 17, 2011 at 9:02 am
I have a database in which I pull the following events from a query:
select
loginname,
servername,
databasename,
starttime
eventclass,
eventname
from dbo.audit_table
where eventclass = 20
How can I modify my query to only pull the events for the past half hour?
Thx,
Jeff
January 17, 2011 at 9:05 am
add this to your where clause :
AND starttime >= DATEADD(n, -30, GETDATE())
Of course it might also make good sense to to check on the endtime instead...
January 17, 2011 at 9:12 am
We need the DDL code before we can comment really but it should be reasonably straight forward if your 'starttime' is a DateTime datatype.
Something like this should do it:
WHERE starttime > DATEADD(mi,-30, GETDATE())
January 17, 2011 at 9:13 am
Thx for the syntax! Greatly appreciated.
Unfortunately, the end date is not a column I can pull from so start date will have to suffice for now.
Jeff
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply