I would like to remove default values from all fields used by all feature classes in an SDE geodatabase. I do not see a geoprocess for removing the default value, only setting it. So I am trying to set it to "".
My approach is to use python to iterate through each feature dataset, then feature class, then field, and set the default value to "".
Here's what I have so far:
import arcpyfrom arcpy import envenv.workspace = r"Database Connections\mysde.sde"dsList = arcpy.ListDatasets("*", "Feature")for dataset in dsList: fcList = arcpy.ListFeatureClasses("*","",dataset) for fc in fcList: flds = arcpy.ListFields(fc,"*","String") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, "") flds = arcpy.ListFields(fc,"*","Double") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) flds = arcpy.ListFields(fc,"*","SmallInteger") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) flds = arcpy.ListFields(fc,"*","Integer") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) flds = arcpy.ListFields(fc,"*","Single") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) When I run the script I get an error 000735 which means a default value is required.
How do I get around this (if at all possible)?
Thanks!
أكثر...
My approach is to use python to iterate through each feature dataset, then feature class, then field, and set the default value to "".
Here's what I have so far:
import arcpyfrom arcpy import envenv.workspace = r"Database Connections\mysde.sde"dsList = arcpy.ListDatasets("*", "Feature")for dataset in dsList: fcList = arcpy.ListFeatureClasses("*","",dataset) for fc in fcList: flds = arcpy.ListFields(fc,"*","String") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, "") flds = arcpy.ListFields(fc,"*","Double") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) flds = arcpy.ListFields(fc,"*","SmallInteger") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) flds = arcpy.ListFields(fc,"*","Integer") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) flds = arcpy.ListFields(fc,"*","Single") for fld in flds: arcpy.AssignDefaultToField_management(fc, fld.name, None) When I run the script I get an error 000735 which means a default value is required.
How do I get around this (if at all possible)?
Thanks!
أكثر...