Solved

Show Table Status Where Rows 100 Then Insert?

Posted on 2008-06-19
3
499 Views
Last Modified: 2008-06-19

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)
0
Comment
Question by:kvnsdr
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 21824114
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
 
LVL 24

Assisted Solution

by:mankowitz
mankowitz earned 500 total points
ID: 21824124
After that, you can use the insert...select syntax

INSERT t2 (col, col, col) SELECT col,col,col FROM information_schema
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 21828242
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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now