SAP HANA SQLScript

Date & Time Processing

16 flashcards · answers and spaced-repetition review in the KnowCard app

What does each return with TO_VARCHAR? ``` TO_VARCHAR( TO_TIME('13:07:38'),'HH12') TO_VARCHAR( TO_TIME('13:07:38'),'SSSSS') ```
This insert fails. Why, and how do you fix it? ``` INSERT INTO dates VALUES('01=02=2017'); ```
What does each expression return for the date 2018-12-27? ``` TO_VARCHAR(d,'RM') TO_VARCHAR(d,'MON') TO_VARCHAR(d,'DDD') ```
These are ABAP DATS strings, VARCHAR(8) in YYYYMMDD form. What are the two deltas? ``` '20180618' - '20180601' '20180101' - '20180601' ```
What does DAYS_BETWEEN('2017-12-01', '2017-12-08') return, and how is the sign decided?
You want the day-of-month as an integer. EXTRACT(DAY FROM d) works, but DAY(d) reports 'function not found'. What is the standalone function called?
2017-12-08 is a Friday. What does WEEKDAY('2017-12-08') return?
A developer writes SELECT CURRENT_DATE() FROM dummy; and it errors. What is wrong, and how do you get 'now' as a SECONDDATE?
To get a week from now, an ABAP developer writes CURRENT_DATE + 7. What happens in SQLScript?
What does each return with ADD_MONTHS? ``` ADD_MONTHS('2017-02-28',1) ADD_MONTHS_LAST( '2017-02-28',1) ```
What does each return with WEEK? ``` WEEK('2017-12-08') ISOWEEK('2017-12-08') ```
How do you convert a UTC timestamp into a named local zone, and what does the origin argument select?
In the BW 'last completed weeks' filter, what date does this compute? ``` ADD_DAYS(CURRENT_DATE, UMINUS( WEEKDAY(CURRENT_DATE)+1)) ```
You need to store a point in time accurate to whole seconds, with no fractional part. Which of DATE, TIME, SECONDDATE, TIMESTAMP fits, and what is the trap?
An empty DATE was inserted. What does this return? ``` SELECT TO_VARCHAR(date_val) AS s, DAYS_BETWEEN(date_val, '0001-01-10') AS d FROM date_values; ```
The Web IDE shows dates as DD.MM.YYYY. A developer calls TO_VARCHAR(some_date) with no format argument. What layout comes back?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play
Date & Time Processing (SAP HANA SQLScript) · KnowCard