0

hey all

i have a database containing many tables, 2 of the tables are same in attributes numbers and names but differs in tables names.

one is titled livecases and other is titled archivecases.
the two tables have a forgien key "typeid" from a table "ctype" to declare type of the case.

i can insert directly into archivecases but when i am using this command:
insert into archivecases select * from livecases where "condition"
i cant do it. "this sql comand makes u copy data from one table to another"
i got this error:

INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_case_archive_ctype1'. The conflict occurred in database 'zzz', table 'ctype', column 'typeid'. The statement has been terminated.

what the reason for this error? wht is the answer?

sam

thanks in advance

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by web_developer
0

Try providing the field names in your query...

Insert Into archivecases(CompanyName,City)
Select CompanyName, City From livecases
Where Country = 'Germany'

or

check the value entered in livecases table matches with the options available in table 'ctype'

0

thanks man
ur replay help me to find the answer
the problem was i must put the attributes in the 2 tables in same order.

sam

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.