mysql
如題,怎樣先判斷外鍵是否存在,然后在刪除,像
if exists((select count(*) from information_schema.key_column_usage where constraint_name=’fk_emp_dept_id’) > 0)
alter table org_employee drop foreign key fk_emp_dept_id;
還有,
if exists((select count(*) from information_schema.key_column_usage where constraint_name=’fk_emp_dept_id’) > 0)
begin
alter table org_employee drop foreign key fk_emp_dept_id;
end
都會報錯,求大神解答
回復內容:
https://zhidao.baidu.com/question/692089969116125764.html
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END