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 |
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-02-03 : 14:16:49
|
| I have a smaldatetime field in my table. I need to do a select to see if that date is < 10 minutes from the current date. How do I do this?DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-02-03 : 14:46:16
|
Only an approach, but it must be something like this:select * from tablewhere yourColumn between dateadd(minute,-10,getdate()) and getdate() No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-02-03 : 14:58:02
|
| Does that not look for a 10 minute window?DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
 |
|
|
revdnrdy
Posting Yak Master
220 Posts |
Posted - 2009-02-03 : 15:29:33
|
| Hello;Here is a code snippet from a query where I look for the last 2 days from a column called date_time.You could modify it to reflect minutes (similar to webfreds post).[CODE]WHERE date_time > DATEADD(day, DATEDIFF(day, 0, GETDATE())-2,0)[/CODE]What it does is looks back over the last 2 days (hence the -2)Hope that helpsr&r |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-02-03 : 16:27:27
|
quote: Originally posted by helixpoint Does that not look for a 10 minute window?DaveHelixpoint Web Developmenthttp://www.helixpoint.com
Yes!I think I don't understand what you want - sorry.Webfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|