Skip to content

Instantly share code, notes, and snippets.

@splee
Forked from lithix-src/gist:4677404
Last active December 11, 2015 23:29
Show Gist options
  • Save splee/4677465 to your computer and use it in GitHub Desktop.
Save splee/4677465 to your computer and use it in GitHub Desktop.
select count(*)
into @exists
from information_schema.tables
where table_schema = 'dbs_admin'
and table_name = 'dbs_auto_increment';
set @qry = select if(@exists<0,
'rename table publisher.dbs_auto_increment to dbs_admin.dbs_auto_increment',
'select \'table exists\' status') as querystr;
prepare stmt from @qry;
execute stmt;
drop @exists;
drop @qry;
drop stm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment