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 - 2011-01-13 : 10:03:45
|
| I have a table that has errors with a field that has the error date with a format like so "2010-09-13 15:27:30.327" I need to do a select statement that selects all errors from 7 am that day to 7 am the previous day. How can I do that?DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2011-01-13 : 10:10:45
|
| [code]select fields from Errors where date >= dateadd(hh,7,dateadd(dd,0,datediff(dd,0,getdate())-1)) and date <= dateadd(hh,7,dateadd(dd,0,datediff(dd,0,getdate())))[/code] |
 |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-01-13 : 10:25:36
|
| That is great thanxDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
 |
|
|
|
|
|