Hi! I would like to change the primary key in my record and use another field instead (the created field would be a concat() from other two fields).
Even though I have been trying, I´m finding trouble when trying to change the condition of primary key and give it to another field. I don´t want this primary key to be AUTO-INCREMENT and, when I try to put another field as primary key, an error occurs. Is it possible to eliminate the primary key and convert the other one into a primary key?
Otherwise, how can I solve this?
Discussion posts and replies are publicly visible
I think you can solve the issue by removing the auto-increment on your concatenated key.
You should then be able to run your statement.
The auto increment is in my primary key (not in the concatenated one, this last is the one I want to change to my primary key)
I retired the auto-increment from the primary key and tried to change the primary key, but this error appears:
There is already a duplicate value in that field. You need to remove that first.
Alright. I have to options to continue (for what I´ve searched) and would like your advice:
1) "Index" another primary key (in this case, I would have 2 primary keys, I don´t know if it is a correct approach)
2) Eliminate the actual primary key and substitute it for the other one (I remember that when I tried, it gave me an error when trying to eliminate it in the record, there was a warning message of mapping)
3) Only change the condition of primary key from one field to another (the variable I want to retire from primary key is auto-increment, and the new one isn´t)
Trying to use a non-unique value as a primary key contradicts the nature of a primary key. That's my advice.