I need to count the exact row count of the tables in my DB (not using TABLE_ROWS from INFORMATION_SCHEMA) I am trying to execute the the script from this post
SET @tableSchema = 'Db_Warehouse';
SET SESSION group_concat_max_len = 10000000;
SET @rowCounts = (
SELECT GROUP_CONCAT(CONCAT('SELECT ''',TABLE_NAME,''', COUNT(*) FROM ', TABLE_NAME) SEPARATOR ' union all ')
FROM information_schema.tables WHERE table_schema = @tableSchema
);
PREPARE statement FROM @rowCounts;
EXECUTE statement;
But I keep getting Error Code 1064:
<e>Query: PREPARE statement FROM @rowCounts
Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table union all SELECT 'COX_ClientSatisfaction', COUNT(*) FROM COX_ClientSatisfa' at line 1
Hope you can advise.