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 |
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2003-10-15 : 06:37:49
|
| I have a date field that defaults to a time value of 00:00:00:0000 I need a select statement that finds all of the data that doesn't equal the default (regardless of the datepart)I tried SELECT TIME FROM TABLE WHERE TIME <> <Various Combinations of dates and times>but none of them seemed to extract what I wanted. Any clues anybody?thankssteveSteve no function beer well without |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-10-15 : 07:27:03
|
| [code]select timefrom tablewhere time <> dateadd(dd,datediff(dd,0,time),0)[/code] Jay White{0} |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2003-10-15 : 07:50:22
|
| ThankyouSteve no function beer well without |
 |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-10-15 : 13:26:54
|
... orWHERE convert(varchar, time, 114) <> '00:00:00:000'114 |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-10-15 : 13:53:52
|
| I would expect the conversion to be slower. I'm pretty sure I've tested this in the past, but not with 114 ... Don't have time at the minute to run perf testing on it ...Jay White{0} |
 |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-10-15 : 14:04:49
|
| Hm... interesting... really needs testing. |
 |
|
|
|
|
|