代码改变世界

mysql 查看是否存在某一张表

2016-03-16 14:52  youxin  阅读(15974)  评论(1编辑  收藏  举报

判断表是否存在

SELECT table_name FROM information_schema.TABLES WHERE table_name ='yourname';

 

或者

SHOW TABLES LIKE 'TB1' 
有一点不好的是返回的形式是Tables_in_数据库名 (搜索条件)
不能把返回的重命名。


判断存储过程是否存在

select * from information_schema.ROUTINES a where a.SPECIFIC_NAME='sp_analy setimeout'