troubleshooting Question

SQL 2008 - Date Filter for TODAY and TODAY-30 Days

Avatar of allenkent
allenkentFlag for United States of America asked on
Microsoft SQL Server 2008
4 Comments1 Solution79 ViewsLast Modified:
I have this date format in my view (table) :  2017-03-10 13:45:16.567

I am trying to get today only in my view. I have tried the following:

SELECT     TOP (100) PERCENT DateCompleted
FROM         dbo.tblSuperDateChecker
WHERE     (DateCompleted = RTRIM(CONVERT(char(10), GETDATE(), 101)))

SELECT     TOP (100) PERCENT DateCompleted
FROM         dbo.tblSerialMasterPending
WHERE     (DateCompleted = CONVERT(Varchar(8), GETDATE(), 112))

I have piece of data that should be showing: (here is date filter removed). The top line should display because today is the 10th
2017-03-10 13:45:16.567
2017-03-09 13:45:13.550
2017-03-09 13:45:10.540
Join our community to see this answer!
Unlock 1 Answer and 4 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 1 Answer and 4 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