This code uses the Teradata SQL PIVOT function and the DBC tables to generate the Teradata SQL Collect Stats statement. Just copy the code and enter your database name and t