Sitemap
Abpgupta

Abpgupta

Denodo Queries

Jan 7, 2022

Frequently Used Functions

To convert Text to Date:

TO_DATE(‘yyyy-MM-dd’,max(case when code = ‘ETL’ then STRT_DT else null end))

Get Year of Current Date

SELECT GETYEAR(CURRENT_DATE()) AS current_date_1, CURRENT_DATE AS

current_date_2

Compare till end of previous Month:

Get Abpgupta’s stories in your inbox

Join Medium for free to get updates from this writer.

and table.postng_dt < FIRSTDAYOFMONTH(CURRENT_DATE())

Go Back two years based on current date:

SELECT ADDYEAR(FIRSTDAYOFMONTH(CURRENT_DATE()) , -2) AS current_date_1,CURRENT_DATE AS current_date_2

To get Last day of Month from Year and Month

SELECT LASTDAYOFMONTH(TO_DATE(‘yyyy-MM-dd’, ‘2010–07–01’))

SELECT LASTDAYOFMONTH(TO_DATE(‘yyyyMMdd’, ‘20100701’))

String can be created using Year and Month.

To convert integer to Text

cast(‘text’, year)

--

--