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 |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2011-06-03 : 04:27:19
|
Dear All,I have a table with 5 column out of which one column datatyp is "Datetime"ID,Country,Dateruled IsactiveEx: 1,India,Rural,2008-05-15 18:30:00.000 ACTIVEThe datatype for the Dateruled column is of Datetime.When i query a table usingselect * from <tablename> where Dateruled='2008-05-15'will not result any result set even though we have records.But when i use select * from <tablename> where Dateruled>='2008-05-15'It shows all the records above that date.Could somebody help me to how do we fetch the records for that date.Thanks,Gangadhara MSSQL Developer and DBA |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-06-03 : 04:35:12
|
that is because the value of that Dateruled is 2008-05-15 18:30 and this is not equal to '2008-05-15'By specifying '2008-05-15', it means '2008-05-15 00:00:00' which is midnight if you only want Dateruled for 2008-05-15, specify the where condition likewhere Dateruled >= '2008-05-15'and Dateruled < '2008-05-16' KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|