Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

FORMULA IN-DB SQL expression to transform dates into year, month, week and day

tclopes
5 - Atom

Hello everyone, 

 

Pretty new to In-db tools and SQL. I am trying to simply convert a date into Year, Month, Week and day.  

 

I tried doing the following. 

 

SELECT
YEAR(GETDATE("order_createdat"))

SELECT
MONTH(GETDATE("order_createdat"))

SELECT
DATEPART(WEEK,GETDATE("order_createdat"))

SELECT
DAY(GETDATE("order_createdat"))

 

Again, really new to this, so any help would greatly be appreciated! Thanks!

1 REPLY 1
AkimasaKajitani
17 - Castor
17 - Castor

Hi @tclopes 

 

SQL functions are different for each database.

 

For example, the below function will be work well in MS SQL.

 

YEAR("order_createdat")

MONTH("order_createdat")

DAY("order_createdat")

 

I recommend to see the reference of SQL function in your DB.

Labels
Top Solution Authors