cancel
Showing results for 
Search instead for 
Did you mean: 

Record count from 500 tables

Former Member
0 Kudos

Hi,

I have 500 tables (user defined) at schema 'SAPABC' in HANA db and would like to get a record count of each of them, how can get it in the following format :

SCHEMA_NAME     TABLE_NAME                   Records

SAPABC                    /BIC/SZVOYAGE               500000
SAPABC                     /BIC/EZADFC001              2000

Thank you

Jonu Joy

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184768
Active Contributor
0 Kudos

Did you try with

SELECT schema_name, table_name, record_count from M_CS_TABLES

In case the table is partitioned, you may have to sum(record_count) with grouping on schema_name, table_name.

Regards,

Ravi

Former Member
0 Kudos

but how do we input 500 tables names to the sql query?

rindia
Active Contributor
0 Kudos

Hi Jonu,

How many tables are there in your schema?

If there are around 550 tables then you can use "NOT IN" with 50 tables.

Regards

Raj

Former Member
0 Kudos

thx raj, we have more than 10000 tables

former_member184768
Active Contributor
0 Kudos

What kind of application are you running .

Why don't you insert the data to another 10001th table and then apply the filters the way you want. Or even dump the output from that table to excel or something and then use it.

Ravi

Former Member
0 Kudos

not running any application, just trying to get a record count from 500 individual tables .

former_member184768
Active Contributor
0 Kudos

Well, may be you can create a table (T_TABLES) with just one column (C_TAB_NAME). Insert your 500 table names to this table and then set up a join with M_CS_TABLES and T_TABLES on table_name = t_tab_name and get the output.

You can always modify the records from T_TABLES and get the output.

Ravi

Former Member
0 Kudos

thx Ravi, do we query the M_CS_TABLES or M_TABLES, as M_TABLES would have both row and coloumn tables

former_member184768
Active Contributor
0 Kudos

M_CS_TABLES will contain only column tables. You can use M_TABLES for both row and column tables. For additional details on row tables, you can use M_RS_TABLES.

Ravi