Home Forums SQL Server 2012 SQL 2012 - General Extract all tables names and their rowcounts from SQL linked server tables RE: Extract all tables names and their rowcounts from SQL linked server tables

  • helal.mobasher 13209 (10/7/2015)


    I am using the following select statement to get the row count from SQL linked server table.

    SELECT Count(*) FROM OPENQUERY (CMSPROD, 'Select * From MHDLIB.MHSERV0P')

    MHDLIB is the library name in IBM DB2 database. The above query gives me only the row count of table MHSERV0P. However, I need to get the names, rowcounts, and sizes of all tables that exist in MHDLIB librray. Is it possible at all?

    Thank you,

    You might be better off asking that question in a DB2 forum. Once you know the answer, you can plug it into your OPENQUERY statement.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.