on 07-12-2018 1:26 AM
I'm using the following SQL script:
SELECT EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) As COMMYEAR
FROM "_SYS_BIC"."tfx.adhoc.Greg_Test/CV_SALES_W_PRICINGCV_TEST"
GROUP BY EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC)
ORDER BY EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) ASC;
and it operates just fine, outputting a list from 2007 to 2018. However, if we include the below line:
WHERE EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) IN (2011, 2012, 2013)
to subset certain years, HANA returns:
Could not execute 'SELECT EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) As COMMYEAR FROM ...' in 114 ms 271 µs .
[303]: invalid DATE, TIME or TIMESTAMP value: search table error: [6931] attribute value is not a date or wrong syntax
I'm using Tableau to connect to HANA, which generates a similar filtering statement. I've tried even filtering for 1 value as text = '2018'
but HANA continues to output the error.
The column FPCOMMNPERIOD_CALC is a calculated column, where ZTFPCOMN is for e.g. '2018007' (2018 period 007).
leftstr("ZTFPCOMN",4)+'-'+rightstr("ZTFPCOMN",2)+'-'+'01')
Hi Greg,
It seems EXTRACT needs be date <d> field. EXTRACT Function (Datetime)
You may take a look into converting FPCOMMNPERIOD_CALC to date type first with using EXTRACT. Possibly TO_DATE Function (Data Type Conversion)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.