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 |
|
abbas
Starting Member
3 Posts |
Posted - 2005-01-18 : 23:47:25
|
| HelloI am having problem with comparing dates in SQL server 2000 the problem is that i want to select all the records where the date is say 16-01-2005 , there are two records with the same date in the table i.e. 16-01-2005 but the querey is not selecting them i am using = operator. The problem i guess is that the time does not match, because the date i am giving is 1/16/2005 10:48:02 PM and the dates in the tables from where i want ot reteive data are 1/16/2005 12:39:41 AM and 1/16/2005 12:39:41 AM ... how can i retreive.So similarly i am having problems when i am comparing date <= myprovideddate and same for >=Waiting for HELP! |
|
|
RM
Yak Posting Veteran
65 Posts |
Posted - 2005-01-19 : 00:25:24
|
| You can compare the date by converting it like Convert(varchar(15),@date, 101). Look for the date and time functions and convert in BOL. |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-01-19 : 07:29:58
|
| [code]select col_listfrom mytablewhere datecol between @inputparam and @inputparam + 1[/code] Manipulating your data column can work (I use dateadd(dd,datediff(dd,0,myDateCol),0) for better performance), but the compiler won't be able to use any indexes on your date data.Jay White |
 |
|
|
|
|
|