SQL access to geodatabase data
You can use SELECT statements in the native SQL of your database management system (DBMS) to read data from the datasets in an ArcSDE geodatabase.
Specify the table (or tables) from which you want to select data in your SQL statement. For example, this simple query returns information from the name and sp_id columns in the flyway feature class:
SELECT name, sp_id FROM yousir.flyway;
When you query a feature class, you are querying the data in the base (or business) table. If the feature class you are querying meets the following criteria, querying the base table is sufficient to see the data:
- The data does not participate in geodatabase functionality such as archiving, annotation, replication, networks, parcel fabrics, relationship classes, cartographic representations, schematic datasets, subtypes, domains, terrains, or topology.
- The feature class is not versioned.
- The feature class uses a SQL spatial type for geometry storage.
- Native DBMS XML columns are used instead of ArcSDE XML columns.
If the data you want to access participates in geodatabase functionality, uses binary geometry storage, or uses ArcSDE XML, you must construct your query to include the required associated tables and join them using the correct columns to see the information in the associated tables.
If your feature class is versioned, you can create multiversioned views on the feature class and query it. When a dataset is versioned, edits to the table are stored in associated adds and deletes tables (the delta tables). Multiversioned views are a mechanism for querying the base table of a versioned dataset that allows you to see the associated values in the adds and deletes tables. You can use functions or procedures installed in the database with ArcSDE, along with SQL queries, against the multiversioned view to see the data in the base, adds, and deletes tables of a specific dataset without having to write complex join statements.