How can i check if the table mysql.proc exists -
i working on wpf application installs if mysql installed, before installation want check whether mysql.proc
table exists or not. googled , ended query
select * information_schema.tables table_schema = schema() , table_name = 'mysql.proc'
this query returns empty row.
i tried simple select statement select * mysql.proc
, , returned table names of stored procedures, if table didn't exists throws exception in c# code.
so there way can fire query c# , boolean value depending on whether mysql.proc
table exists or not?
try show tables mysql 'proc'
. if there no result rows, table doesn't exist. if there 1 row, table exists. note approach isn't portable across rdbmss, though doesn't seem concern of yours.
as first query, schema()
returns default database, if it's not "mysql", query fail. likewise, data in table_name
column doesn't include database name, comparing 'mysql.proc' fail.
Comments
Post a Comment