Home  >  Article  >  Database  >  How to solve the problem that objects already exist in the database

How to solve the problem that objects already exist in the database

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-05-21 16:42:0718708browse

Solutions to objects that already exist in the database: 1. Add the "IF OBJECT_ID ('table name') IS NOT NULL DROP PROCEDURE table name; GO" statement before the create statement; 2. Modify the table name. Rerun.

How to solve the problem that objects already exist in the database

The operating environment of this tutorial: windows7 system, mysql8.0 version, Dell G3 computer.

This situation usually occurs when running the SQL statement again. There are two ways to solve it:

1. Add:

IF OBJECT_ID ( '表名' ) IS NOT NULL
 DROP PROCEDURE 表名;
 GO

2. Sometimes Because the main code of the database to be deleted is used in other tables, it cannot be deleted. At this time, you can rerun it by modifying the table name.

Related recommendations: "mysql tutorial"

The above is the detailed content of How to solve the problem that objects already exist in the database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn