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.
- If the table contains any XML columns, they are the native DBMS type 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 use a versioned view to query it and see the data in the base, adds, and deletes tables of the feature class without having to write complex join statements. Beginning with ArcGIS 10.1, a versioned view is created when you register the feature class as versioned. For feature classes that were versioned prior to ArcGIS 10.1, you can use the Create Versioned View command in ArcGIS for Desktop or the Create Versioned View geoprocessing tool to create a versioned view on the versioned feature class.