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 |
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-19 : 08:07:33
|
| any ideas why this wont workselect * from dbo.ErrorLogwhere ErrorTime = '05-03-2008' |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-19 : 08:11:27
|
| try thisIf u r dateformat is mm-dd-yyyyselect * from dbo.ErrorLogwhere convert( varchar(12),ErrorTime,110) = '05-03-2008'If u r dateformat is dd-mm-yyyy then use thisselect * from dbo.ErrorLogwhere convert( varchar(12),ErrorTime,105) = '05-03-2008' |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-19 : 08:15:41
|
select * from dbo.ErrorLogwhere ErrorTime >= '2008-05-03' -- May 3rd 2008and ErrorTime < '2008-05-04' -- May 4th 2008 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-19 : 08:16:16
|
| perfect cheers |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-19 : 08:47:25
|
quote: Originally posted by rjhe22 any ideas why this wont workselect * from dbo.ErrorLogwhere ErrorTime = '05-03-2008'
the reason why it didnt work is because you had timepart along with date value in ErrorTime column.the value 05-03-2008 corresponds to start of day 05-03-2008 which is 12 midnight |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-01-19 : 08:55:49
|
quote: Originally posted by rjhe22 any ideas why this wont workselect * from dbo.ErrorLogwhere ErrorTime = '05-03-2008'
Also you expressed dates in ambiguious format. Use universal format YYYYMMDDMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|