DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Procedure Analyse Against All Tables
// Finding optimum column type based on the data already entered, using procedure analyse for each table.
// # usage analyse.sh myDB_Name
#!/bin/bash # finding optimum column type based on the data already entered # using procedure analyse for each table # usage analyse.sh myDB_Name > /backup/max.txt while read tblname ; do mysql -e"select * from $tblname procedure analyse()\G" >> /backup/max.txt done <<HERE `mysql -Be"select CONCAT(TABLE_SCHEMA, '.' , TABLE_NAME) as noname from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '$1'"` HERE





