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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 CONVERT (VARCHAR(20), myDate, 101) problem

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-02-20 : 17:23:31
In order to get rid of time in smalldatetime data, I use
CONVERT (VARCHAR(20), myDate, 101). Now, another problem is if I search Max myDate, 12/31/2004 is become max, not 12/23/2005. I think that because 31>23. How to solve this problem?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-20 : 17:26:26
use this method to remove the time.

select dateadd(day, 0, datediff(day, 0, myDate))

----------------------------------
'KH'

Time is always against us
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-02-20 : 17:55:19
Thank you. It works great! No more time and MAX, MIN are all fine!!!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-21 : 01:08:34
If you convert date value to varchar datatype, performing MIN, MAX and comparison will give you wrong result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -