You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求可获取所有计算视图名称及其行数的SQL查询语句

Get Calculation View Names and Row Counts in SAP HANA

Got it! Since you're working with SAP HANA (evidenced by your use of SYS.M_TABLES for tables), here's a SQL query that mirrors your existing table query but targets calculation views:

SELECT 
    CV.VIEW_NAME AS CALC_VIEW_NAME,
    CS.RECORD_COUNT
FROM 
    SYS.M_CALC_VIEWS CV
INNER JOIN 
    SYS.M_CS_TABLES CS 
    ON CV.SCHEMA_NAME = CS.SCHEMA_NAME 
    AND CV.VIEW_NAME = CS.TABLE_NAME
WHERE 
    CV.SCHEMA_NAME = 'YOUR_SCHEMA_NAME'; -- Replace with your actual schema name

Key Details:

  • SYS.M_CALC_VIEWS is the system view dedicated to storing metadata for calculation views, including their names and associated schemas.
  • SYS.M_CS_TABLES provides statistics for column store objects—this is where we pull the RECORD_COUNT value, just like you do for tables in SYS.M_TABLES.
  • If your row counts look outdated, refresh the statistics first with this command:
    UPDATE STATISTICS ON SCHEMA YOUR_SCHEMA_NAME;
    
  • If you ever need to include all view types (not just calculation views), swap SYS.M_CALC_VIEWS with SYS.M_VIEWS in the query.

内容的提问来源于stack exchange,提问作者Gaurav Meshram

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 04:28:15