Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I get the following error:

ERROR 1062 (23000) at line 1901: Duplicate entry '3-3820-50-0' for key
 'UNQ_CAT_CTGR_ENTT_DTIME_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID'

How can I find out which table and columns this is referring to?

share|improve this question
    
What version of MySQL? Are you using innodb? –  FreshPhilOfSO Oct 5 '12 at 12:02
add comment

1 Answer

up vote 4 down vote accepted

This should do it:

select table_schema, table_name, column_name
from information_schema.key_column_usage
where constraint_name = 'UNQ_CAT_CTGR_ENTT_DTIME_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID'
order by ordinal_position
share|improve this answer
1  
Yes it would, +1 !!! Hope you don't mind but I added table_schema so that the database of the table is known as well. –  RolandoMySQLDBA Oct 5 '12 at 17:03
    
@RolandoMySQLDBA: good point. Thanks. –  a_horse_with_no_name Oct 5 '12 at 17:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.