<?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>topic Re: Is there an efficient way in ArcObjects to delete many tables at once? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440245#M11952</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the ideas of using arcpy but I was looking for an ArcObjects solution. I've not found an interface that would do a bulk deletion. Sometimes the Interface can have a very odd name. I have thought that it may be quicker to copy out the tables that should remain, blitz the database and rename the new database?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Feb 2016 09:41:16 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2016-02-15T09:41:16Z</dc:date>
    <item>
      <title>Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440243#M11950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a tool that can populate a file geodatabase with hundreds to several thousand tables (some tables can be very small others very large). My current VB code searches the file geodatabase and deletes tables using the following logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim pEnumDataset As IEnumDataset
pEnumDataset = pWorkspace.Datasets(esriDatasetType.esriDTTable)
pDataSet = pEnumDataset.Next
Do While Not pDataSet Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If pDataSet.CanDelete = True Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Right(pDataSet.BrowseName, 12) = "Upstream_IDs" Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pDataSet.Delete()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Error
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp; pDataSet = pEnumDataset.Next
Loop&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When there are thousands of tables ending with the suffix "upstream_IDs", this process can be quite slow. I don't want to delete the entire geodatabase as there may be other tables that need to remain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if any ArcObjects Guru out there know of a way to batch delete tables? I was thinking if there was some way of providing a list or an enumerator to some interface that can delete tables efficiently?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:42:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440243#M11950</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-11T19:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440244#M11951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how about an arcpy solution &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listtables.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listtables.htm"&gt;ListTables—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;with perhaps the wildcard being your suffix&lt;/P&gt;&lt;P&gt;It should provide a list, then you can use &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/delete.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/delete.htm"&gt;Delete—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;to delete the elements from the list.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Feb 2016 20:46:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440244#M11951</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-14T20:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440245#M11952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the ideas of using arcpy but I was looking for an ArcObjects solution. I've not found an interface that would do a bulk deletion. Sometimes the Interface can have a very odd name. I have thought that it may be quicker to copy out the tables that should remain, blitz the database and rename the new database?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 09:41:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440245#M11952</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2016-02-15T09:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440246#M11953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't answer your question directly because the method is IDasaset.Delete. But why you don't use a gdb separate or a scratch gdb for these tables (I guess that are scratch tables) ? So you can delete entire gdb ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 11:56:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440246#M11953</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2016-02-15T11:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440247#M11954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They are not scratch tables. They are topological information of river networks one for each catchment so they need to persist. It's just that occasionally they need refreshing and my current method (code above) works it's just a bit slower than I would like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 12:01:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440247#M11954</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2016-02-15T12:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440248#M11955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;Is possible remove only rows and mantain table (use truncate)? &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fhelp.arcgis.com%2FEN%2Fsdk%2F10.0%2FArcObjects_NET%2Fcomponenthelp%2Findex.html%23%2F%2F0025000008n5000000" rel="nofollow" target="_blank"&gt;http://help.arcgis.com/EN/sdk/10.0/ArcObjects_NET/componenthelp/index.html#//0025000008n5000000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Truncating tables The ITableWrite2.Truncate method provides a way to quickly delete every row in a table (or every feature in a feature class). It is only available for local geodatabase classes and for non-versioned classes in ArcSDE. Caution should be taken when using this method, for two reasons: ##All complex behavior is bypassed when calling this method. Calling it on a dataset that participates in a composite relationship class, participates in a controller dataset such as a topology, or has custom behavior defined (i.e., using a class extension) will likely cause data corruption. This should only be used to truncate simple data. ##This method ignores schema locks. If the dataset is being used by other users they may experience unexpected behavior.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 12:20:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440248#M11955</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2016-02-15T12:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440249#M11956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm... interesting! My tables are simple standalone tables so not participating in any other relation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So are you saying if I truncate the table (thus deleting all contents) then delete the table using &lt;EM&gt;pDataSet.Delete()&lt;/EM&gt; that this will be quicker than simply deleting the table (because it has thousands of rows in it)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 12:46:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440249#M11956</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2016-02-15T12:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440250#M11957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought enough you remove all records but if you need also remove tables I don't know if the two operations are quicker that a single operation (IDataset.Delete)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 13:17:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440250#M11957</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2016-02-15T13:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440251#M11958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Domenico,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I knocked together the following VBA code and ran it against identical geodatabases using just delete and then truncate and delete, the lines marked with '** I commented out when running a straight delete:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Public Sub test()
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pWorkspaceFactory As IWorkspaceFactory
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pWorkspaceFactory = New FileGDBWorkspaceFactory
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pWorkspace As IWorkspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pWorkspace = pWorkspaceFactory.OpenFromFile("C:\Scratch\fGDB_NetworkConnectivity.gdb", 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFeatureWorkspace As IFeatureWorkspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFeatureWorkspace = pWorkspace
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim t1, t2 As Date
&amp;nbsp;&amp;nbsp;&amp;nbsp; t1 = Now
&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print t1
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Loop through workspace deleting Tables
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pTableWrite As ITableWrite2
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEnumDataset As IEnumDataset
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pEnumDataset = pWorkspace.Datasets(esriDatasetType.esriDTTable)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pDataSet As IDataset
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pDataSet = pEnumDataset.Next
&amp;nbsp;&amp;nbsp;&amp;nbsp; Do While Not pDataSet Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If pDataSet.CanDelete = True Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Right(pDataSet.BrowseName, 12) = "Upstream_IDs" Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pTableWrite = pFeatureWorkspace.OpenTable(pDataSet.Name) '**
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pTableWrite.Truncate '**
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pDataSet.Delete
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pDataSet = pEnumDataset.Next
&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; t2 = Now
&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print t2
&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print DateDiff("S", t1, t2)
End Sub&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is that it is slower to truncate then delete than to simply just delete. Well it was worth a try...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:42:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440251#M11958</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-11T19:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an efficient way in ArcObjects to delete many tables at once?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440252#M11959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know you are looking for an ArcObjects solution but I wanted to mention this approach.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Create a new empty geodatabase&lt;/P&gt;&lt;P&gt;2) In ArcCatalog connect to the source database and select everything except the tables you want to delete.&lt;/P&gt;&lt;P&gt;3) Paste your selection into the new database.&lt;/P&gt;&lt;P&gt;This approach will get you a new database without the tables you wanted removed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2017 03:42:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/is-there-an-efficient-way-in-arcobjects-to-delete/m-p/440252#M11959</guid>
      <dc:creator>GregRieck</dc:creator>
      <dc:date>2017-08-17T03:42:30Z</dc:date>
    </item>
  </channel>
</rss>

