DATA Step, Macro, Functions and more

Searching a DB2 libref for particular tables by name or date

Reply
Contributor
Posts: 20

Searching a DB2 libref for particular tables by name or date

I'm using access to see these db2 tables, but they get updated or tables get added and i'd like to search the library ref by table name and update date.

Is this something proc contents will do? or something else?

I've got 9.12 on the PC running

thanks

gary

SAS Employee
Posts: 104

Searching a DB2 libref for particular tables by name or date

You might try reading the DB2 dictionary tables with explicit SQL passthrough.  The code would look something like this (at the minimum, the items in CAPS will need to be modified):

proc sql;
   connect to db2(database=MYDB);
   select * from connection to db2
      (select tabschema
              , tabname
              , create_time
              , stats_time
         from syscat.tables
         where tabschema = 'SCHEMA_NAME'
         order by typename);
   disconnect from db2;
quit;
Ask a Question
Discussion stats
  • 1 reply
  • 132 views
  • 0 likes
  • 2 in conversation