Link to home
Start Free TrialLog in
Avatar of marrowyung
marrowyung

asked on

filter out mySQL table name

Dear all,

right now try to filter out table name with prefxi tblT_ so we don't want this kind of table from showing out, my query is :

 SELECT  DISTINCT TABLE_NAME 	
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA=<databaseName>  and table_type<> 'view' and TABLE_NAME  NOT LIKE 'tblT_%';

Open in new window


and I try to test the result set by only show out table has prefix like that:

 SELECT  DISTINCT TABLE_NAME 	
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA=<databaseName>  and table_type<> 'view' and TABLE_NAME  LIKE 'tblT_%';

Open in new window


but it seems MySQL will return all table with name prefix with tblT% instead of what we want : tblT_xxxxxx

how to solve this ?
ASKER CERTIFIED SOLUTION
Avatar of Haris Dulic
Haris Dulic
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marrowyung
marrowyung

ASKER

very nice !