Notice
Recent Posts
Recent Comments
Link
| ์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- Update
- ๋์
- JSP
- select
- JavaScript
- ๋ฐฐ์ด
- MySQL
- order by
- ๋ณ์
- ๋์ปค
- ํจ์
- SQL
- ๋ฐฑํฑ
- post๋ฐฉ์
- ํ๋ก๊ทธ๋๋จธ์ค
- ๋ฆฌ๋ ์ค
- Ajax
- JS
- optionํ๊ทธ
- ํ ์ด๋ธ
- DATE_FORMAT
- ์๋ฐ์คํฌ๋ฆฝํธ
- oracle
- ๋์ ํ ์ด๋ธ
- like
- Spring
- ์ฝํ
- ์ปจํธ๋กค๋ฌ
- ๋ช ๋ น์ด
- ์ธ๋ผ์ธ๋ทฐ
Archives
- Today
- Total
bom's happy life
[MYSQL] ํ ์ด๋ธ์ ์ปฌ๋ผ ์ถ๊ฐ ์ ์ธ๋ํค์ค์ ์๋ฌ ํด๊ฒฐ๋ฐฉ๋ฒ ๋ณธ๋ฌธ
Deveolpment Study๐๏ธ/Databases
[MYSQL] ํ ์ด๋ธ์ ์ปฌ๋ผ ์ถ๊ฐ ์ ์ธ๋ํค์ค์ ์๋ฌ ํด๊ฒฐ๋ฐฉ๋ฒ
bompeach 2023. 11. 30. 17:24์๋ฌ:
SQL Error [1452] [23000]: Cannot add or update a child row: a foreign key constraint fails ~~~

ํด๊ฒฐ๋ฐฉ๋ฒ :
//1. ๋จผ์ ์ธ๋ํค๋ฅผ ๋ฌด์ํ๋๋ก ์ฒ๋ฆฌ
SET foreign_key_checks = 0;
//2. ์ถ๊ฐํ๊ณ ์ํ๋ ์ปฌ๋ผ๊ณผ ์ธ๋ํค ์ค์
ALTER TABLE ACCNT ADD (
`central_dept_seq` int(11) NOT NULL COMMENT '๋ณธ๋ถ SEQ',
KEY `FK_ACCNT_DEPT` (`central_dept_seq`),
CONSTRAINT `FK_ACCNT_DEPT` FOREIGN KEY (`central_dept_seq`) REFERENCES `DEPT` (`dept_seq`)
)
//3. ์ธ๋ํค ์ ์ฝ์กฐ๊ฑด์ด ๋ค์ ์๋ํ๋๋ก ์ฒ๋ฆฌ
set foreign_key_checks = 1;
.
.
์ฐธ๊ณ ๋ธ๋ก๊ทธ
https://hdhdeveloper.tistory.com/61
[MySQL] Error 1452
0 121 Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (``.``, CONSTRAINT `FK_code_to_code` FOREIGN KEY (``) REFERENCES `` (``)) 0.016 sec ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๋ ์ธ๋ ํค๋ฅผ ์กฐ์(์ฝ์ ,์์ ๋ฑ)ํ ๋ ๋ฐ์ํ
hdhdeveloper.tistory.com