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 2012 Forums
 Transact-SQL (2012)
 Comparing 2 dates

Author  Topic 

thakur80
Starting Member

3 Posts

Posted - 2015-04-06 : 11:55:50
Hi there, I am running a query with 2 separate date fields (i.e., when an application is taken and when dislocures were sent out). I need to compare the 2 dates to determine if the disclosures were sent within 3 business days of the application date. I am not very good with dates formula so any help would be greatly appreciated. I started off with the following command:

Case when (L2.N_3144 > L2.N_3142) then 'Pass' else 'Fail' end Outcome

MichaelJSQL
Constraint Violating Yak Guru

252 Posts

Posted - 2015-04-06 : 12:08:27

my mistake -- case

Case when DATEDIFF(dd,d1,d2) >=3 then 'Pass' else 'Fail' end Outcome


you can change the operand to > if = to is not in your criteria
Go to Top of Page
   

- Advertisement -