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 |
btkaruna
Starting Member
8 Posts |
Posted - 2010-07-06 : 12:50:12
|
Hi,How to get max date before next day A.M time, passing before day p.m time.i.e for example we have following data date in dd/mm/yyyy format06/07/2010 5:40 p.m06/07/2010 8:00 p.m07/07/2010 2:00 A.m07/07/2010 3:00 A.Mif i send 06/07/2010 as input parameter i need to get 07/07/2010 3:00 A.M |
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-06 : 13:07:36
|
and what happens if there is no record for 07/07 if you pass the parameter 06/07?Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
btkaruna
Starting Member
8 Posts |
Posted - 2010-07-06 : 13:08:26
|
if no data then it displays null. |
 |
|
btkaruna
Starting Member
8 Posts |
Posted - 2010-07-06 : 13:21:12
|
The data that was posted is sample data to explain my query |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2010-07-06 : 14:27:37
|
Assuming the date is stored as a datetime:select max(MyDate)from MyTablewhere MyDate > '20100707 03:00:00.000' If date is actually stored as a string like you showed, you will have to convert that to datetime before you can compare it.CODO ERGO SUM |
 |
|
|
|
|