I have 2 Tables: TABQUANHEGD: destination and TABNGUON: source
I implemented sql in SQL Server 2005 with an error
- INSERT INTO TABQUANHEGD(IDQHGD, MASTT, NGUOITHAN, NGAYSINH, MAGT, MAQH, MAQT, OHIENTAI, NGHENGHIEP, NOILAM, DIENTHOAI, TRUGIACANH, NGAYBD, NGAYKT, LIENHE, DAMAT, ANH, GHICHU)
- SELECT IDQHGD, MASTT, NGUOITHAN, NGAYSINH, MAGT, MAQH, MAQT, OHIENTAI, NGHENGHIEP, NOILAM, DIENTHOAI, TRUGIACANH, NGAYBD, NGAYKT, LIENHE, DAMAT, ANH, GHICHU FROM TABNGUON;
Msg 547, Level 16, State 0, Line 1
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_TABKHOKIEMKECT_TABKHOKIEMKE". The conflict occurred in database "NhanSu", table "dbo.TABQUANHEGDTT", column 'IDQH'.
The statement has been terminated.
In the database I don't have these 2 tables:
TABKHOKIEMKECTTABKHOKIEMKE
I don't know where to get these 2 Tables to report an error
I want to copy the content from Table1 to Table2, how do I write an SQL query ?
Nisha RegilRank #1,956 · 748 reputationPosted Sep 4, 2020, 1:21 AM EDT
Dong Lam TrienRank #1,538 · 1K reputationPosted Sep 6, 2020, 4:22 PM EDT
Nilesh ShahRank #42 · 34.2K reputationPosted Sep 6, 2020, 4:48 PM EDT
TABQUANHEGDTT.
Dong Lam TrienRank #1,538 · 1K reputationPosted Sep 7, 2020, 4:05 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts