Rob D. A.
Rob D. A.

Reputation: 134

How can I get a list of all tables in database with selected prefix?

As in subject title. My database contains a huge amount of auxiliary tables. Would like to build a dropdown list to select table I would like to load content from. This code ... does not work:

SELECT table_name FROM sys.tables WHERE table_name LIKE 'Mytable_%'

Upvotes: 2

Views: 622

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

In mysql you could access to information_schema filter your db name

 SELECT table_name 
 FROM INFORMATION_SCHEMA.TABLES
 WHERE table_schema = 'your_db_name'
 and table_name LIKE 'Mytable_%'
 and table_type = 'BASE TABLE'; 

Upvotes: 3

Related Questions