Answers.Body: <p>As said by Jitendra, you cannot update the id via CiviCRM api. The id in civicrm tables are autoincremented and are referenced at many places. If you still want to take risk than you can run a sql query in mysql to update the id of required row in civicrm_option_value table.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-13T13:29:41.253Z
Answers.LastActivityDate: 2019-12-13T13:29:41.253Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I'm trying to update the ID of an existing OptionValue using API v4. I get "Cannot update the id of an existing OptionValue" error. Is there another way to do that? </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-13T09:12:45.037Z
Comments.Text: `id` is an autoincremented value in DB which should be set by DB itself. Updating the id directly in such a way is not a very good idea. Can you let us know what you are trying to achieve?
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-13T15:36:23.633Z
Comments.Text: Jitendra I'm trying something to fix this, see https://civicrm.stackexchange.com/q/33833/186
Comments.UserDisplayName: Joe McLaughlin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-13T23:36:21.613Z
Comments.Text: Are you sure it's the "id" you want to update? For option values it's usually the value in the "value" column that gets used and/or stored in the foreign table, if you're trying to fix something that got out of whack.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-13T23:58:37.163Z
Comments.Text: @Demerit yeah it was definitely the ID. I was able to do it using mysql at the command line. I was attempting to fix the problem in the Q linked in the above comment, changing the didn't do the trick. I had deleted the City, County and State/Province option values in Addressing Options, duh on me, then added them back in, but of course they had a new auto-incremented ID number. I thought that restoring to the previous ID would fix the problem with the City, County and State/Province not appearing when editing an Address in the Summary screen.
Comments.UserDisplayName: Joe McLaughlin
Tags: <api><option>
Title: Can I update the id of an existing OptionValue?
ThreadText: # Can I update the id of an existing OptionValue?
  
  (Asked by: username_0 on 2019-12-13)
  
  I'm trying to update the ID of an existing OptionValue using API v4. I get "Cannot update the id of an existing OptionValue" error. Is there another way to do that?
  
  **Tags:** api, option
  
  > **Comments:**
  > **username_1**: `id` is an autoincremented value in DB which should be set by DB itself. Updating the id directly in such a way is not a very good idea. Can you let us know what you are trying to achieve?  
  > **username_0**: Jitendra I'm trying something to fix this, see https://civicrm.stackexchange.com/q/33833/186  
  > **username_2**: Are you sure it's the "id" you want to update? For option values it's usually the value in the "value" column that gets used and/or stored in the foreign table, if you're trying to fix something that got out of whack.  
  > **username_0**: @username_2 yeah it was definitely the ID. I was able to do it using mysql at the command line. I was attempting to fix the problem in the Q linked in the above comment, changing the didn't do the trick. I had deleted the City, County and State/Province option values in Addressing Options, duh on me, then added them back in, but of course they had a new auto-incremented ID number. I thought that restoring to the previous ID would fix the problem with the City, County and State/Province not appearing when editing an Address in the Summary screen.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2019-12-13. Score: 1 | Accepted answer
  
  As said by Jitendra, you cannot update the id via CiviCRM api. The id in civicrm tables are autoincremented and are referenced at many places. If you still want to take risk than you can run a sql query in mysql to update the id of required row in civicrm\_option\_value table.
  
  
  ---
  
  