Search code examples
sqlmacrosteradatateradata-sql-assistant

How to list down all defined macros in Teradata?


I have created few macros in Teradata. But now im not remembering all the macro names . Can anyone please help me to retrieve all defined macros in Teradata


Solution

  • You can use the dbc.tablesV view to get all macros:

    SELECT *
    FROM dbc.tablesV
    WHERE tablekind = 'M' -- table (T), view (V), macro (M), stored procedure (P)
    ;
    

    Depending on your TD version, you may have a couple different versions of the view available: dbc.tables, dbc.tablesV, dbc.tablesX, dbc.tablesVX:

    V - supports extended object names (128 characters)
    X - only shows objects the current user has permission to
    VX - combination of the two
    

    TD Manual
    Reference