Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm wanting to parse through an entire ArcSDE database (feature dataset, features classes, tables, everything...) searching for a field (compkey) and export the numbers to a txt file.

share|improve this question

closed as unclear what you're asking by PolyGeo, Chad Cooper, Mapperz May 21 at 13:52

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
So what's your question exactly? And what DBMS is being used? –  blah238 Mar 5 '12 at 11:47
add comment

1 Answer 1

If your data is not versioned (or you've compressed and updated the base tables), you could just use SQL to query out the IDs.

For a manual, one-time-only, type of query, I've used this SQL query (ORACLE) to generate a second SQL query. You could replace the COUNT(*) as ROWCOUNT with a COMPKEY and add additional where clause conditions (you will probably want to change OWNER ='SDE' to OWNER IN ('SCHEMA1','SCHEMA2','SCHEMA3') if you have GIS data in multiple schemas).

select 
    'SELECT COUNT(*) as ROWCOUNT,'''|| t.owner||'.'||t.TABLE_NAME||''' as ClassName FROM '||t.OWNER||'.'||t.TABLE_NAME||' UNION' as SelectStatement 
from sde.table_registry t
where t.owner = 'SDE'
and t.owner||'.'||t.TABLE_NAME in (select OWNER||'.'||TABLE_NAME  
from all_tab_cols where column_name = 'COMPKEY' and OWNER ='SDE'
order by t.table_name

So the above query will generate a list of select statements with a 'UNION' at the end.

copy/paste that into a new query window (delete the 'UNION' from the last line). and that will give you your list. If you are using SQL Developer or Toad, those applications have built-in capability to export to text file.

If your data is versioned, you should probably look at building multi-versioned views for the versioned featureclasses. Assuming that you would be querying from each featureclass/table at the same version, you could do the same sort of union query but using the multi-version views.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.