<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>idea Fields View — Change data type of existing NULL field when table has rows in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idi-p/1360777</link>
    <description>&lt;P&gt;In an empty table in Pro 2.6.8, we can change the datatype of a field, such as from TEXT to LONG. But that only works if the table is empty. If the table has rows, then the datatype is greyed out in the Fields View, so it can't be changed using Pro.&lt;/P&gt;&lt;P&gt;In the back-end of a database, it's possible to change the datatype, even if the table has rows, as long as all the rows are null in that field. (It might even be possible for non-null fields too; I haven't checked.)&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.w3schools.com/sql/sql_alter.asp#:~:text=ALTER/MODIFY%20DATATYPE" target="_self"&gt;ALTER TABLE - ALTER/MODIFY DATATYPE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Oracle example:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#999999"&gt;--change a text field to an integer datatype&lt;/FONT&gt;&lt;BR /&gt;ALTER TABLE a_test_fc&lt;BR /&gt;MODIFY a_test_field INT;&lt;/PRE&gt;&lt;P&gt;But if I do that, the change is not reflected in the Fields View in ArcGIS Pro. I guess there must be geodatabase system table info that stores the original datatype; Pro isn't referencing the actual datatype from the database. (Interestingly, I'm still able to edit the data/field in the attribute table in Pro without issue; I can enter integers into the field. And of course, text values are no longer allowed.)&lt;/P&gt;&lt;P&gt;While changing the datatype through the back-end technically ran without errors, I wouldn't want to do that because now the geodatabase system tables are wrong. At best, that'll cause confusion for users, since the Fields View is displaying the incorrect datatype. At worst, it could cause errors in ArcGIS Pro.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could ArcGIS Pro be enhanced so that we can change the datatype of a null field, even if the table has rows?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 17:10:17 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2023-12-14T17:10:17Z</dc:date>
    <item>
      <title>Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idi-p/1360777</link>
      <description>&lt;P&gt;In an empty table in Pro 2.6.8, we can change the datatype of a field, such as from TEXT to LONG. But that only works if the table is empty. If the table has rows, then the datatype is greyed out in the Fields View, so it can't be changed using Pro.&lt;/P&gt;&lt;P&gt;In the back-end of a database, it's possible to change the datatype, even if the table has rows, as long as all the rows are null in that field. (It might even be possible for non-null fields too; I haven't checked.)&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.w3schools.com/sql/sql_alter.asp#:~:text=ALTER/MODIFY%20DATATYPE" target="_self"&gt;ALTER TABLE - ALTER/MODIFY DATATYPE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Oracle example:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#999999"&gt;--change a text field to an integer datatype&lt;/FONT&gt;&lt;BR /&gt;ALTER TABLE a_test_fc&lt;BR /&gt;MODIFY a_test_field INT;&lt;/PRE&gt;&lt;P&gt;But if I do that, the change is not reflected in the Fields View in ArcGIS Pro. I guess there must be geodatabase system table info that stores the original datatype; Pro isn't referencing the actual datatype from the database. (Interestingly, I'm still able to edit the data/field in the attribute table in Pro without issue; I can enter integers into the field. And of course, text values are no longer allowed.)&lt;/P&gt;&lt;P&gt;While changing the datatype through the back-end technically ran without errors, I wouldn't want to do that because now the geodatabase system tables are wrong. At best, that'll cause confusion for users, since the Fields View is displaying the incorrect datatype. At worst, it could cause errors in ArcGIS Pro.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could ArcGIS Pro be enhanced so that we can change the datatype of a null field, even if the table has rows?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 17:10:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idi-p/1360777</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-12-14T17:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1360959#M27570</link>
      <description>&lt;P&gt;Example use case — change datatype without losing field order:&lt;/P&gt;&lt;P&gt;I want to change the datatype of an existing field (table has rows) without losing the field order of my existing fields. In this particular case, the field isn't completely null. So I'll add a new field (or a related table) to temporarily store the existing values, populating the temporary field using the field calculator. Then I'll use the field calculator to set the original field in question to null. And change the datatype. Then I'll re-populate the field using the field calculator and delete the temporary field or temporary table.&lt;/P&gt;&lt;P&gt;That workflow would allow me to change the datatype of an existing populated field, without losing the field order, as long as the values in the field are compatible with the new datatype.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I suppose the holy grail would be: Change the datatype of a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;non-null field&lt;/STRONG&gt;. But I'm not sure how many database vendors support that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 16:57:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1360959#M27570</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-12-14T16:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361104#M27583</link>
      <description>&lt;P&gt;Thanks for the idea&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You're correct, changing the datatype on the backend is not a recommended workflow. Any schema manipulation inside of an enterprise geodatabase that does not occur in ESRI software risks complications with your data.&lt;/P&gt;&lt;P&gt;You are also correct that the datatypes in ArcGIS Pro are not read from the database itself, but are read from a table in the geodatabase.&amp;nbsp; This is because ArcGIS datatypes do not match the native datatypes of every RDBMS.&amp;nbsp; In order for these fields to be consistent within ArcGIS Pro and across platforms, the displayed datatypes are defined by the geodatabase system tables, and not the underlying RDBMS data types.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You've definitely hit on a key point here in your last comment:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"I suppose the holy grail would be: Change the datatype of a&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;non-null field&lt;/STRONG&gt;&lt;SPAN&gt;. But I'm not sure how many database vendors support that."&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Many RDBMS do not support in-place modification at all, whether the field is null or non-null.&amp;nbsp; For instance, changing the data type of a column in an Oracle or PostgreSQL database requires a rewrite of the table in its entirety.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 19:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361104#M27583</guid>
      <dc:creator>SSWoodward</dc:creator>
      <dc:date>2023-12-14T19:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361132#M27584</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/604859"&gt;@SSWoodward&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Many RDBMS do not support in-place modification at all, whether the field is &lt;STRONG&gt;null&lt;/STRONG&gt; or non-null. For instance, changing the data type of a column in an Oracle or PostgreSQL database requires a rewrite of the table in its entirety.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I'm understanding correctly, that doesn't sound quite right to me.&lt;/P&gt;&lt;P&gt;As mentioned in the original idea, when it comes to Oracle, I was able to change the datatype of a EGDB FC column if all the values were &lt;STRONG&gt;null&amp;nbsp;&lt;/STRONG&gt;(the FC had rows).&lt;/P&gt;&lt;P&gt;This Oracle fiddle demonstrates it:&amp;nbsp;&lt;A href="https://dbfiddle.uk/f0gTR6Fi?highlight=8" target="_blank" rel="noopener"&gt;https://dbfiddle.uk/f0gTR6Fi?highlight=8&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Likewise, it seems to work in Postgress too:&amp;nbsp;&lt;A href="https://dbfiddle.uk/GZzh2PSE?highlight=4" target="_blank" rel="noopener"&gt;https://dbfiddle.uk/GZzh2PSE?highlight=4&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 20:36:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361132#M27584</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-12-14T20:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361148#M27586</link>
      <description>&lt;P&gt;Yes those results make sense, those tables are new, and have been re-written in their entirety. Not modified in-place.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 21:03:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361148#M27586</guid>
      <dc:creator>SSWoodward</dc:creator>
      <dc:date>2023-12-14T21:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361153#M27587</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/604859"&gt;@SSWoodward&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you saying that ALTER TABLE actually tells the database to DROP the entire table and re-CREATE it?&lt;/P&gt;&lt;P&gt;That seems strange to me. My limited understanding is ALTER TABLE modifies the table in-place.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 21:09:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361153#M27587</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-12-14T21:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361205#M27589</link>
      <description>&lt;P&gt;Its unexpected, isn't it! It really surprised me as well when I learned it.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;From the &lt;A href="https://www.postgresql.org/docs/8.0/sql-altertable.html" target="_self"&gt;PostgreSQL Docs&lt;/A&gt;:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"The fact that&amp;nbsp;&lt;/SPAN&gt;ALTER TYPE&lt;SPAN&gt;&amp;nbsp;requires rewriting the whole table is sometimes an advantage...."&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;The same is true for Oracle.&amp;nbsp; I'm not sure that its exactly the same as DROP under the hood, but the whole table is recreated from scratch.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 22:24:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361205#M27589</guid>
      <dc:creator>SSWoodward</dc:creator>
      <dc:date>2023-12-14T22:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Fields View — Change data type of existing NULL field when table has rows</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361291#M27594</link>
      <description>&lt;P&gt;Yeah, that's surprising.&lt;/P&gt;&lt;P&gt;When we change the datatype of a field in an &lt;STRONG&gt;empty&lt;/STRONG&gt; table using the current ArcGIS Pro functionality, does that behave the same way? Does it replace the table?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 05:19:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fields-view-change-data-type-of-existing-null/idc-p/1361291#M27594</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-12-15T05:19:06Z</dc:date>
    </item>
  </channel>
</rss>

