Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jtrumbul
Starting Member
11 Posts |
Posted - 2008-10-24 : 15:09:32
|
| Hey all, was wondering something. I need to write a query that will select a record count based on wether or not any new records were added in the last 2 minutes based off a smalldatetime field. the field is called IncidentTime how would i write this query? select count(*) from cnEventLog where IncidentTime > and <= getDate()i will then be using the reurned count in a vb.net application. any help is appreciated. thanks,John |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2008-10-24 : 15:43:54
|
| see if this works for you...WHERE IncidentTime BETWEEN DATEADD(MI, -2, GETDATE()) AND GETDATE() |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-10-24 : 15:45:30
|
| WHERE IncidentTime >= DATEADD(minute,-2,getdate())Jim |
 |
|
|
|
|
|