cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HANA SQL based calculation view issue

Former Member
0 Kudos

Hi

I am trying to create a SQL script based calculation view with below sample query

select 10 top * from sales group by region, amount

If I execute this query in SQL editor it returns only 10 rows as expected

But if use the same query and create calculation view and use Data Preview option, it returns more rows e.g in my case 5000 as Max row count is set to 5000

Is this limitation in Calculation view or Max Row count has precedence over the row count returned in the query?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

henrique_pinto
Active Contributor
0 Kudos

You could try to use SELECT * FROM TABLE LIMIT N [OFFSET M] syntax instead.

If necessary, use the ORDER BY statement (prior to the LIMIT statement) so you get the desired records.

Check the HANA reference for more details: http://help.sap.com/hana/html/sql_select.html

Former Member
0 Kudos

Thanks Henrique...this works

Answers (1)

Answers (1)

former_member184768
Active Contributor
0 Kudos

Hi Nikhil,

One quick question.

Is your query in the Calc view "select TOP 10 * ...".

When you do the data preview, the generated Query adds TOP clause based on the no of rows displayed setting for data preview. You can check the query in Information / View Log next to data preview button.

Please confirm.

Regards,

Ravi

Former Member
0 Kudos

Hi Ravi,

Yes you are correct..

Select top 10 * is overwritten by Data Preview TOP clause, which logically should not happen as query only returns 10 rows!!!!

Regards,

Nikhil

former_member184768
Active Contributor
0 Kudos

Hi Nikhil,

Did you try executing select * from the Calc view directly, with your calc view containing TOP 10 clause.

In this case, TOP N from data preview will not come in picture. As you know, data preview is just another feature for data checking. I personally don't use it as it selects all columns and performs a group by with all columns.

The practical use of the Calc view using any reporting tool may generate a different query.

Regards,

Ravi

Former Member
0 Kudos

Hi Ravi,

I already executed the calc view as mentioned, having Top 10 clause...

It doesn't works.

My only concern is if I create BO exploration view on the Calculation view, will it fetch 10 records or all? I tried creating BO explorer on Cal view and it seems that it pulls up all records

Thanks,

Nikhil

rama_shankar3
Active Contributor
0 Kudos

Nikhil:

BO explorer pulling all the calculation view data is natural behaviour. If you need additional filters, they you need to add them to the calculation view.

REgards,

Rama