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?


thanks in advance

Try providing the field names in your query...

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


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

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.