troubleshooting Question

What's wrong with the DateDiff here?

Avatar of lapucca
lapucca asked on
Microsoft SQL Server 2005SQL
20 Comments4 Solutions342 ViewsLast Modified:
I have a record that has active and CompletedImpForm both equal to true(or 1, they're bit) with
DateOfFirstVisit=2011-05-01 00:00:00.000

I try to run that just now and no record is selected.  5/15 - 5/1 , is 14 days then why didn't this record got selected?  How to fix this?  Thank you.
select StudyId,accountKey,emailAddress from dbo.Patients  
	where Datediff(d,getdate(), DateOfFirstVisit)%14 = 0
	and Active=1 and CompletedImpForm=1

Open in new window

ASKER CERTIFIED SOLUTION
Qlemo
"Batchelor", Developer and EE Topic Advisor

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2015

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 4 Answers and 20 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros