Show Table Status Where Rows 100 Then Insert?


Q. Anyway to Insert the results of Show Table Status into another table?

ie... Insert Into table2 (col_Name, col_Rows) Values (show table status where rows > 100)
LVL 1
kvnsdrAsked:
Who is Participating?
 
mankowitzCommented:
Unfortunately, you can not capture output from a SHOW command. If you want manipulate the data, you will have to select it from INFORMATION_SCHEMA

e.g.

SELECT * FROM information_schema.`TABLES` where table_schema = 'test'
0
 
mankowitzCommented:
After that, you can use the insert...select syntax

INSERT t2 (col, col, col) SELECT col,col,col FROM information_schema
0
 
kvnsdrAuthor Commented:
Finished, working code:

Insert Into MyDatabase.table1 (`col_Name`, `col_Rows`) SELECT `Table_Name`, `Table_Rows` FROM information_schema.`TABLES` where table_schema = 'test'

Perfect,

Thank You...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.