Context I want to use the HANA HIERARCHY_TEMPORAL function to work on a SAP KNVH hierarchy with time intervals ; When simply used in a SELECT query, this works fine ; When otherwise using the very same query but assigning it to a table variable, the result is inconsistent. My problem This anonymous block works just fine using an HANA
Tag: hana
Calculating checksum in Big Query
I have a query in SAP HANA like below. I am calculating check_sum based on some column in the table Now I have created the same table in Big Query. I want to calculate check_sum in Big Query and get the same result as in SAP HANA I have tried like below It says TO_BINARY function is not available. I
SQL group and condition sum in the last row
I have several items which belongs to different group, some are unknown group. I need the sum of each group by date. I just try below SQL but still not exactly what I want: DB: SAP HANA Data: Item PG NET_VALUE_USD EMANAGER_DATE 1 1 100 2021-09 2 1 200 2021-10 3 2 300 2021-09 4 2 400 2021-09 5 3
SQL, retrieving only entries that all the IDs of its many-to-many relation are in an array
need some help with a SQL query. Below I wrote an example of what I want: I need to retrieve entries that the user has privileges to see all of its components. The privileges are stored in an array, for example, I’m a user with the following privileges: [1,2,3] In the database, I have a table with the following entries:
HANA: How to add a unique contraint on a column that is already indexed?
Having the following schema: I am trying to a unique contraint to the column. But this runs into an error: I can understand that the column is already indexed because I have created the index by myself. But I want the column to be unique. Is there a way to do this? Answer This is indeed an undocumented limitation in
Drop partition if exists in HANA
I would like to know if there is a way to DROP a partition IF EXISTS in HANA. I have tried like below I am getting incorrect syntax error near IF What is the best available solution? Answer HANA does not support the IF EXISTS clause. You may want to work around this limitation by implementing your own “IF EXISTS”,
Disregard duplicate rows only when these rows are contiguous
I am trying to show only the first occurrence of an activity if this activity occurs multiple times in a row. Thus, in the scenario below, if activity B occurs 3 times in a row, even if it is at different times, I want to only select the first occurrence. If it occurs again AFTER another activity I also want
Calculation view for material to material transfer
I have a table Tab1 with two rows +——-+———-+————–+———-+——–+ | DOC# | Material | Debit/Credit | Quantity | Amount | +——-+———-+————–+———-+——–+…
can I place a sql query in a sql hana place holder
can I place a sql query in a sql hana place holder? the following query works: I am trying to pass something like the following: Currently getting a syntex error Answer As error says you, expressions are not supported for column view parameter: Can’t use column expression as column view parameter. However, there are options to calculate it: If your
Two dimensional comparison in sql
DB schema There are rows with the same cryptid, I need to squash them to one row. So the cryptid becomes effectively unique. The complexity comes from the fact that I need to compare dates by rows as well as by columns. How to implement that? The rule I need to use is: status should be taken from the row