ModelBuilder - Select Table Records then Delete

11228
6
12-28-2010 12:13 PM
MatthewBoyle
Occasional Contributor
I'm trying to run a model where I have an input geodatabase table that I want to select certain records by an attribute and then delete.  I haven't been able to find a good way to do this...any suggestions?

Example: [SN] <> '0530019' AND [SN] <> '0271234'

So I want to delete all the records out of this table that does not meet the SQL expression.


Thanks!
0 Kudos
6 Replies
LoganPugh
Occasional Contributor III
For feature classes, use Make Feature Layer (with a SQL expression), followed by Delete Features.

For tables, use Make Table View (with a SQL expression), followed by Delete Rows.
KeriLu
by
New Contributor

Thank you Logan Pugh! Your post was extremely helpful!

0 Kudos
OlivierOlivier
New Contributor III
And be careful that Make Feature Layer modify your original shapefile !
0 Kudos
AlfredoBriones
New Contributor II
I have the same issue, but with GDB tables (not with feature class tables, but with "non-spatial" tables). "Make feature layer" + "Delete rows" works fine with feature classes, but not with simple tables. Is there any way to do the same process only with tables?

Thanks.
ShitijMehta
Esri Regular Contributor
Use Make Table View tool instead of Make Feature Layer.
0 Kudos
BugPie
by
Occasional Contributor III
For feature classes, use Make Feature Layer (with a SQL expression), followed by Delete Features.

For tables, use Make Table View (with a SQL expression), followed by Delete Rows.


This thread is a bit old, but I wanted to see if anyone is having trouble with this process at 10.1? I use this in a model to first select sites from an SDE poly feature class using "make feature layer", based on SQL query using a view. Then I use delete features to remove those selected features from the feature class. This has been working for us over the last few years and releases. Now that we have moved our prod into 10.1 this process is taking upwards of 10 minutes (to delete 4 - 24 features most times) and seems to be taking longer each iteration which can be from once daily to three times daily. A month ago, this was taking 6 minutes and now we are seeing this take 10+ minutes. Any ideas as to why the time to complete is taking longer and longer? Clearly the addition of new features will cause the performance to drop, but 10 minutes to delete 20 features seems a bit long.

I have Used the "Analyze dataset" & "Rebuild index" GP tools to try and get better performance. No luck.

Any ideas or similar experiences?