I do this in python to update my publication date in the metadata when I truncate and fill a layer from our edit database to our main database. It works pretty well for me.
def UpdateMetadataPublicationDate(LayerToUpdate):
LayerToUpdate = string.split(LayerToUpdate,'\\')[-1]
sde = r'Database Connections\SDE.sde'
sde_conn = arcpy.ArcSDESQLExecute(sde)
sql = '''USE GIS;DECLARE @now varchar(19) = convert(varchar(19),GETDATE(), 126);UPDATE GIS.sde.GDB_ITEMS SET Documentation.modify('replace value of (//metadata/dataIdInfo/idCitation/date/pubDate/text())[1] with sql:variable({0})') where Name = \'{1}\''''.format('\"@now\"',LayerToUpdate)
sde_conn.startTransaction()
sde_conn.execute(sql)
sde_conn.commitTransaction()
/*remove the node in case there is no value yet in the database for the Allias name */ update sde.GDB_ITEMS set Definition.modify('delete(/DEFeatureClassInfo/AliasName)') /*Provide the ObjectId of the feature class - can be checked in properties ArcCatalog 10.1 */ WHERE ObjectId = 1218
/* Provide new alias name in the variable below */ DECLARE @AliasName VARCHAR(1024) = 'Area Committees' UPDATE sde.GDB_ITEMS SET Definition.modify('insert <AliasName>{sql:variable("@AliasName")}</AliasName> into(/DEFeatureClassInfo)[1]') /*Provide the ObjectId of the feature class - can be checked in properties ArcCatalog 10.1 */ WHERE OBJECTID=1218
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.