mysql截断特定规则的表

  • 2021年10月29日
  • Mysql

-- 查询符合条件的表
SELECT CONCAT('truncate table ', table_name, ';') 
FROM
information_schema. TABLES
WHERE
table_schema = 'db-mayn-erp-test'
AND TABLE_NAME LIKE '%purchase%'
AND table_type = 'base table';

-- user 你的表名 
truncate table users;

-- 拷贝查询到的结果,然后运行
truncate table purchase_execute;
truncate table purchase_execute_materials;
truncate table purchase_order;
truncate table purchase_order_materials;

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注