All Forums Database
cpcosinas 1 post Joined 04/11
05 Feb 2012
DBC tables/views to extract Table, View and Macro, etc definitions

Hi,

Just wondering if there is someone here who have created a SQL to extract the definitions of all the Tables, Views, Macro etc.

 

Thanks,

Christian

ulrich 816 posts Joined 09/09
05 Feb 2012

you can run 

select 'show ' !! case when tablekind = 'm' then 'macro' when tablekind = 't' then 'table' when tablekind = 'v' then 'view' end !! ' ' !! trim(databasename) !! '.' !! trim(tablename) !! ';'

from dbc.tables 

where tablekind in ('T','V','M');

and run the generated SQLs afterwards.

 

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

Lizarb 2 posts Joined 12/11
17 Feb 2012

Hi Christian,

You can easily use the DBC.TVM table to extract that info.

Regards,

Lizarb

You must sign in to leave a comment.