Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I am looking to convert this query in Access into SQL Server, how could I go about this?
SELECT Max([CDV_PATIENTS].[DATA_START_DATE]) AS MaxOfDATA_START_DATE, Date() AS TodayDate, IIf([MaxOfDATA_START_DATE]=(Date()-1),"Yes","No") AS MessageFROM CDV_PATIENTS
JezLisle
Posting Yak Master
132 Posts
Posted - 2009-03-26 : 07:24:44
I have read and found this, below, but my problem is the date uses the Time aswell, I need to show the GetDate as dd/mm/yyyy 00:00:00
SELECT MAX([CDV_PATIENTS].[DATA_START_DATE]) AS MaxOfDATA_START_DATE, GETDate()-1 AS TodayDate,CASE WHEN (MAX([CDV_PATIENTS].[DATA_START_DATE]) =(GETDATE()-1)) THEN 'Yes' ELSE 'No'END AS TESTFROM CDV_PATIENTS
How can I do this?
matty
Posting Yak Master
161 Posts
Posted - 2009-03-26 : 08:05:46
SELECT DATEADD(DAY,0,DATEDIFF(DAY,0,GETDATE())) will give date without time.