Peder Rice
Peder Rice

Reputation: 1794

HANA Equivalent of syscomments

I'd like identify all views and procedures in a HANA DB that use a given table. In SQL Server, one can query sysobjects and syscomments like the following:

SELECT
   o.name
FROM sysobjects o
JOIN syscomments c
   ON o.id = c.id
WHERE c.comment LIKE '%tableName%'

Is there an equivalent in HANA?

Upvotes: 1

Views: 1196

Answers (3)

Shidai
Shidai

Reputation: 227

Another approach would be to do like this:

SELECT * FROM OBJECT_DEPENDENCIES
WHERE BASE_OBJECT_NAME='YOUR_TABLE_NAME'

Reference

Upvotes: 1

Andre Rodrigues
Andre Rodrigues

Reputation: 66

I believe the best approach would be to search them using the Public Synonyms of the system, since the current user may not have SELECT privilege on schema SYS. All objects can be found using:

SELECT *
  FROM OBJECTS

For procedures, you can just

SELECT *
  FROM PROCEDURES

For more public synonyms available, check Catalog folder -> Public Synonyms.

Upvotes: 1

Peder Rice
Peder Rice

Reputation: 1794

Well that didn't take long to find. An answer can be found on the SCN.

SELECT
   Procedure_Name
FROM sys.procedures
WHERE Definition LIKE '%tableName%'

Upvotes: 2

Related Questions