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 |
|
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2012-05-15 : 09:41:59
|
I am trying to search in a view for everything with a date of 5/4/12 but my search returns no results. I know there is data in there since if I do not put a date constraint I can see the data. What is the best way of searching on a DATETIME column? The code I use now is:SELECT * FROM viewMimicProviderInquiryRequestsTableWHERE InitialDateofRequest = '2012-05-04'ORDER BY InitialDateofRequest -- If I get used to envying others...Those things about my self I pride will slowly fade away.-Stellvia |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-05-15 : 09:46:41
|
SELECT * FROM viewMimicProviderInquiryRequestsTableWHERE InitialDateofRequest >= '20120504' AND InitialDateofRequest < '20120505'ORDER BY InitialDateofRequest No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2012-05-15 : 09:57:10
|
| I take it then you can not use the "=" sign in date lookups?-- If I get used to envying others...Those things about my self I pride will slowly fade away.-Stellvia |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-05-15 : 10:00:07
|
it is a matter of the time part in a datetime column. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|