ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Using a DateTime Filter in an Oracle SQL Query via Dynamic Input

alexnajm
19 - Altair
19 - Altair

Hello everyone! I have a SQL query in my Dynamic Input tool that I want to modify with a DateTime in the WHERE clause. However, it seems to only be considering the date and not the time when modifying the SQL query to replace a specific string. Here is the query (connects to an Oracle database) with the actual columns and such aliased for privacy:

SELECT A, B, C, Date

FROM X, Y

WHERE X.A = Y.A 

AND Date > '01-Jan-1800'

 

The Dynamic Input has this configuration:

Modify SQL Query - SQL: Update WHERE Clause --> replace '01-Jan-1800' with '12-Nov-2020' (as an example)

 

The above works great with date alone, but when I try to add in time (i.e. '12-Nov-2020' to '12-Nov-2020 12:00:00'), the SQL errors out. After many To_Date and To_Timestamp tries, I figured I would ask the Community for some help. Thank you in advance!

3 REPLIES 3
mceleavey
17 - Castor
17 - Castor

Hi @alexnajm ,

 

can you confirm the source table to which you are applying the query is in a datetime format? if the column does not contain the timestamp then the datetime query will not match the mask of the source data.

 

M.



Bulien

alexnajm
19 - Altair
19 - Altair

Yes I can confirm it is in DateTime format!

alexnajm
19 - Altair
19 - Altair

I found the answer to my own question here. For those who may want to know, this worked:

 

Date > TO_DATE(‘1801-01-01 00:00:00’,’YYYY-MM-DD HH24:MI:SS’)

 

Then Modify SQL Query - Replace a Specific String: 1801-01-01 00:00:00 with the field that has your datetime in the same format 🙂

Labels
Top Solution Authors