Answers.Body: <p>Two issues here.</p>
  
  <p>The first error was already a known issue:</p>
  
  <pre><code>General error: 1366 Incorrect integer value
  </code></pre>
  
  <p>When MySQL's <a href="https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-strict" rel="nofollow">strict mode</a> is enabled, you can get errors like this when swapping an existing field from one type to another where the underlying MySQL datatypes aren't compatible. Swapping from <a href="http://buildwithcraft.com/docs/checkboxes-fields" rel="nofollow">Checkbox</a> to <a href="http://buildwithcraft.com/docs/lightswitch-fields" rel="nofollow">Lightswitch</a> is another time when this could occur.</p>
  
  <p>That one is on our bug tracker, but it's going to be quite an involved fix, so we haven't gotten around to it yet.</p>
  
  <p>The second issue is the one you found. Making the swap from one field type to another <strong>and</strong> changing the field handle at the same time would not only cause the known error to occur, it would render the rest of the control panel unusable.  That bug has been fixed for the next (<a href="http://buildwithcraft.com/updates#build2700" rel="nofollow">post 2.4.2700</a>) release.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T21:17:58.457Z
Answers.LastActivityDate: 2015-10-21T21:23:09.717Z
Answers.LastEditDate: 2015-10-21T21:23:09.717Z
Answers.UserDisplayName: Brad Bell
Body: <p>I've just changed a rich text field to a number field and am now unable to bring up either the front-end or the dashboard because of multiple CDbException errors. When trying to access <code>/admin</code>, here's the first line of the error message:</p>
  
  <p><code>CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content.field_sqFt' in 'field list'</code></p>
  
  <p>I changed a rich text field named <code>projectDescription</code> to a number field named <code>sqFt</code>. I understand that the new column can't be found.</p>
  
  <p>When updating a field type, I know that there's a chance for data loss. Data loss would be ok for the entries that this change would affect. But I've made other changes since my last backup that I'd like to retain if possible.</p>
  
  <p>I'm running the latest Craft Pro.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-21T18:25:10.843Z
Comments.Text: I tried replicating this locally (changing the field type as well as the field handle) and am not able to. Did you make any other changes?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-21T19:24:23.140Z
Comments.Text: I renamed some field groups just prior to this change. But that seemed to work without problems and I don't think that field group names would be related to this.
Comments.UserDisplayName: plaintxt
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-21T19:37:26.177Z
Comments.Text: If you want, you can send a database backup to support@buildwithcraft.com and we can look into it from our end.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-21T19:40:38.693Z
Comments.Text: Great thanks. I'll include a current db and the one just before that.
Comments.UserDisplayName: plaintxt
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-21T19:50:24.447Z
Comments.Text: I've just imported my most recent backup and have changed the field type again. Here's the resulting CDbException, received directly after submitting the change (no refresh etc): `CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '<p>A three-story office building, 123 East Pine Street boasts move-in-ready, furnished executive suites on the first floor a' for column 'field_sqFt' at row 160. The SQL statement executed was: ALTER TABLE `craft_content` CHANGE `field_projectDescription` `field_sqFt` INT(10) UNSIGNED NULL DEFAULT 0`
Comments.UserDisplayName: plaintxt
Tags: <database><field><error>
Title: CDbException after updating field type
ThreadText: # CDbException after updating field type
  
  (Asked by: username_0 on 2015-10-21)
  
  I've just changed a rich text field to a number field and am now unable to bring up either the front-end or the dashboard because of multiple CDbException errors. When trying to access `/admin`, here's the first line of the error message:
  
  `CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content.field_sqFt' in 'field list'`
  
  I changed a rich text field named `projectDescription` to a number field named `sqFt`. I understand that the new column can't be found.
  
  When updating a field type, I know that there's a chance for data loss. Data loss would be ok for the entries that this change would affect. But I've made other changes since my last backup that I'd like to retain if possible.
  
  I'm running the latest Craft Pro.
  
  **Tags:** database, field, error
  
  > **Comments:**
  > **username_1**: I tried replicating this locally (changing the field type as well as the field handle) and am not able to. Did you make any other changes?  
  > **username_0**: I renamed some field groups just prior to this change. But that seemed to work without problems and I don't think that field group names would be related to this.  
  > **username_1**: If you want, you can send a database backup to support@buildwithcraft.com and we can look into it from our end.  
  > **username_0**: Great thanks. I'll include a current db and the one just before that.  
  > **username_0**: I've just imported my most recent backup and have changed the field type again. Here's the resulting CDbException, received directly after submitting the change (no refresh etc): `CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '<p>A three-story office building, 123 East Pine Street boasts move-in-ready, furnished executive suites on the first floor a' for column 'field_sqFt' at row 160. The SQL statement executed was: ALTER TABLE `craft_content` CHANGE `field_projectDescription` `field_sqFt` INT(10) UNSIGNED NULL DEFAULT 0`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-21. Score: 0 | Accepted answer
  
  Two issues here.
  
  The first error was already a known issue:
  
  ```
  General error: 1366 Incorrect integer value
  
  ```
  
  When MySQL's [strict mode](https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-strict) is enabled, you can get errors like this when swapping an existing field from one type to another where the underlying MySQL datatypes aren't compatible. Swapping from [Checkbox](http://buildwithcraft.com/docs/checkboxes-fields) to [Lightswitch](http://buildwithcraft.com/docs/lightswitch-fields) is another time when this could occur.
  
  That one is on our bug tracker, but it's going to be quite an involved fix, so we haven't gotten around to it yet.
  
  The second issue is the one you found. Making the swap from one field type to another **and** changing the field handle at the same time would not only cause the known error to occur, it would render the rest of the control panel unusable. That bug has been fixed for the next ([post 2.4.2700](http://buildwithcraft.com/updates#build2700)) release.
  
  
  ---
  
  