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-08-03 : 15:27:05
|
| I need to do a select to find if the records were added yesterday. There is a dateTime field???DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-08-03 : 15:37:55
|
| Dang you guys are fast. TanxDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-08-03 : 15:40:40
|
I advice to stop doing arithmetic operations on date and time values. They are no longer supported in Denali.Rewriting Tara's suggestion would then look like1)select ...from twhere d >= DATEADD(dd, DATEDIFF(dd, 1, getdate()), 0) and d < DATEADD(dd, DATEDIFF(dd, 0, getdate()), 0)2)select ...from twhere cast(d as date) = cast(getdate() as date)Also see http://www.sqltopia.com/?page_id=35 N 56°04'39.26"E 12°55'05.63" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-08-08 : 09:58:22
|
| <<They are no longer supported in Denali.>>If the datatype is DATETIME, then no issuesMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|