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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-01-02 : 10:36:38
|
| Senthil writes "I put one condition in the SQL stmnt Convert(Varchar(10),getdate(),101) <= Convert(varchar(10),'01/02/2001',101)Assume today's date is '01/02/2001'IT retruns the records of Dec 29th also,but it should'nt becuase getdate() is greater than Dec 29thTo aviod this i put :Convert(datetime,getdate(),101) <= Convert(datetime,'01/02/2001',101)Assume today's date is '01/02/2001'This condition is failed since todays date is compared with both date and time(ie it is compared as '2002-01-02 13:50:02.733' <= '2001-01-02 00:00:00.000'Can any one solve this problem" |
|
|
izaltsman
A custom title
1139 Posts |
Posted - 2002-01-02 : 10:52:03
|
| Use ISO date format (or another ymd-like format) to get proper sorting:Convert(Varchar(10),getdate(),112) <= '20010102'Edited by - izaltsman on 01/02/2002 10:53:19 |
 |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-01-02 : 11:03:07
|
| How About this 1cast(Convert(varchar(12),getdate(),101) as datetime) > cast(Convert(varchar(12),'12-28-2001',101) as datetime)HTH----------------------------Anything that Doesn't Kills you Makes you Stronger |
 |
|
|
|
|
|
|
|