3

We're running SDE and have several feature sets with versioning turned on. When I query those layers via ArcGIS Engine or ArcGIS Server, all expected features are returned.

We have numerous non-GIS applications that use SQL queries to access information from the spatial data. However, we don't get all the features that I'm expecting to be returned. How do I access the features that have been added/deleted (and are, therefore, "hidden" from a straight SQL query)?

4

As long as it is just the attributes that you are after, you can set up a multi-versioned view using sdetable.exe.

sdetable.exe -o create_mv_view -T mvv_wMeter -t wMeter

Then on your db connection, you execute the set_current_version stored proc to set the version, then issue your select statement on the multi-versioned view:

exec sde.set_current_version 'SDE.SOMEOTHERVERSION'  
GO  
Select COUNT(*) from mvv_wMeter ;  
1
  • 1
    i don't have it my example, but sdetable.exe needs db connection info arguments: -s,-i,-u,-p,-D in some combination depending on your config (I usually just set the SDEDATABASE,SDEINSTANCE,SDESERVER env vars in a batch file--sdetable use the env vars if they exist). – Jay Cummins Aug 6 '10 at 19:39
4

I think this ESRI support page may be relevant.

I believe it is worth posting the warnings on that page here:

Never use database management system (DBMS) tools to update any row ID (object ID) field maintained by ArcSDE in the database. These object ID fields are allocated and managed by the geodatabase and, therefore, should not be altered using SQL.

Never edit the DEFAULT version of the geodatabase using SQL. Starting an edit session on a version obtains an exclusive lock on the state that the version references. If you lock the DEFAULT version, you prevent ArcGIS users from connecting to the geodatabase.

In the 9.3 help page they also warned against editing non-simple feature class attributes (Geometric Networks, Topologies, etc.) via SQL.

1

When you edit data in SDE with versioning it doesn't get written directly to the table (feature class), edits are stored in delta tables (adds/deletes) until the database is compressed.

Esri understands these delta tables and applies them transparently however the base table is not modified so direct connections will not see the edits...

If you are using an environment where QGIS and ArcGis for example are using PostGIS data any edits made by ArcMap will not be visible in QGIS but the QGIS edits are immediately committed and are visible in ArcMap on the next save.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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