Ever tried changing the data type of a field in a feature class or table in a File Geodatabase? If you haven't, then believe me, it is not as easy as you would think. The only way of doing it is to actually create a new field and copy the values across.
As an example, let's say we want to change Field1 from an integer to a double field
- Close ArcCatalog (it will almost definitely have a lock on the database that you can't get rid of any other way)
- Rename Field1 to Field2
- Create a new field called Field1 (type=double)
- Copy any values across using the field calculator
- Delete Field2
From this point on, you have to put up with Field1 being the last field in the table, which can be pretty annoying if you have spent the time setting up your feature classes in a logical order, with similar attributes situated near one another.
What is the alternative I hear you ask?
- Export your table/feature class to a Personal Geodatabase
- Open the database in Microsoft Access
- Open the table in Design View
- Alter the field format
- Copy your table/feature class back to the file Geodatabase
You can also use this same method for renaming fields.
Warning! Be very cautious when doing this. Things can go wrong if you are not careful. Do not change any of the special fields (ObjectID, Shape etc.) as your table will become corrupt. You should always create a backup copy of your data before playing around with the schema of any databases.
No comments:
Post a Comment