DBC.COLUMNSTATS

Database
Enthusiast

DBC.COLUMNSTATS

I have a query which was working and is now returning incorrect results.

The query is against DBC.COLUMNSTATS and basically is a dynamic SQL statement to generate the "collect statistics" statement for a given table, group of tables, etc. I use it to migrate statistics collecting schemes among our three environments (dev, prod, and test).

Under v2r5 it worked fine and only returned those rows on which column statistics had been collected. When we migrated to v2r6 it began retrieving all the rows for every column in the table; irrespective of whether or not statistics have been collected on the column. I checked this through TD Administrator, found a table on which only a couple of column had statistics, ran my statement and sure enough, it returned a row for every column. The definition for DBC.COLUMNSTATS says: "Displays statistics for the columns in a table for which statistics have been collected." Anybody know what gives here. Either I simply didn't notice that it was collecting all the columns before or something has changed.

Does anyone know how to restrict a query against DBC.COLUMNSTATS so the retrieval set is limited to those columns on which statistics have been collected?

Thanks

Craig Windland
2 REPLIES
Enthusiast

Re: DBC.COLUMNSTATS

Use "WHERE FieldStatistics IS NOT NULL" and that will give you only the columns upon which stats have been collected.

Enthusiast

Re: DBC.COLUMNSTATS

Thank you very much!