Procedure Analyse against all tables

Developed In: bash — Contributed by: Shantanu Oak

Finding optimum column type based on the data already entered, using procedure analyse for each table. # usage analyse.sh myDB_Name


Shantanu Oak
bash
  1. #!/bin/bash
  2. # finding optimum column type based on the data already entered
  3. # using procedure analyse for each table
  4. # usage analyse.sh myDB_Name
  5.  
  6. > /backup/max.txt
  7. while read tblname ; do
  8. mysql -e"select * from $tblname procedure analyse()\G" >> /backup/max.txt
  9. done <<HERE
  10. `mysql -Be"select CONCAT(TABLE_SCHEMA, '.' , TABLE_NAME) as noname from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '$1'"`
  11. HERE
  12.  

You must be logged in to tag this tool

No Comments yet

Votes

Not yet rated.
You must be logged in to vote.

Watches

0 members are watching this tool
You must be logged in to track this tool.

Provide Feedback

Please note:
HTML will be purified, but we allow for a number of HTML tags so that you have the flexibility to decorate your comment text to some extent. The comments allow the following HTML tags:

strong, b, em, blockquote, a, code, pre

To put code into your comment, simply encapsulate your code with
[code language="XXX"][/code], where XXX is any common language, for instance "PHP", "SQL", "C", etc.



You must be logged in to comment