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 |
|
sqlchiq
Posting Yak Master
133 Posts |
Posted - 2008-08-26 : 12:13:40
|
| select * from winnebago where ExecutionTime like '%2008%'will return entries, butselect * from winnebago where ExecutionTime like '%2008-08%'will not. i KNOW there are entries that contain 2008-08 in the table, for example2008-08-24 16:38:00.000btw the column is in datetime |
|
|
jdaman
Constraint Violating Yak Guru
354 Posts |
Posted - 2008-08-26 : 12:19:24
|
| try:select * from winnebagowhere datediff(mm, 0, ExecutionTime) = datediff(mm, 0, '20080801') |
 |
|
|
jdaman
Constraint Violating Yak Guru
354 Posts |
Posted - 2008-08-26 : 12:21:18
|
| or better yetwhere ExecutionTime between '20080801' and '20080831 23:59:59.999' |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-26 : 12:49:01
|
| because sql server doesn't know how to implicitly convert 2008-08 to a datetime_______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-27 : 02:57:47
|
quote: Originally posted by jdaman or better yetwhere ExecutionTime between '20080801' and '20080831 23:59:59.999'
orwhere ExecutionTime >='20080801' and ExecutionTime <'20080901'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|