SQL Date Filter not working

karlstadick

New Member
Joined
Jun 30, 2020
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
Hi!

I am expecting this query to only provide me information after the Date

select Date, ID, Activity
from [AZ].[dbo].[VW_ActivityDetails]
where Date > '07-01-2020'
order by Date

1595369762902.png



I have tried using some CONVERT functions on the Date field but they haven't worked.

I am sure it is something simple but I haven't been able to figure it out.

Thank you in advance for your ideas.

Karl
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi!

I have tried the following with no success:

CONVERT(VARCHAR(10), cast(Date as date), 101)
CONVERT(VARCHAR(10), Date, 101)
CONVERT(VARCHAR(10), Date, 103)


I have created and used a number of Date filters before but not necessarily on this database. Not sure why it isn't "behaving". :)

Also, there is no time stamp for this column in the database. This is fine as I don't need it; I simply need to filter on Date.

Any other thoughts?

Thank you!

Karl
 
Upvote 0
Karl

How/where are you trying to run this query?
 
Upvote 0
I am running it on MS SQL Server 2012.

Nothing fancy...just simply executing the query.

Done this many times on different databases with no issue. For some reason, the Date field isn't filtering properly.
 
Upvote 0
Sorry to ask again but how/where are you trying to run this query?

Are you connecting to the database via ADO in VBA?

Are you executing it in SMSS?
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top