What has to be considered for Definition Queries, to ensure compatibility between MDB and SDE?
Definition Queries exist in Layers (in Map Display) and in Annotations (can be modified in ArcCatalog only). Following has to be considered:
Definition Queries are passed to the database directly and has to match SQL Syntax of the DBMS. Thus always ' (inverted comma) has to be used for text values. The " (double quote) only works on MDB.
- correct: NAME = 'Reinhardtstraße 32'.
- wrong: NAME = "Reinhardtstraße 32".
In the label expression of Annotations " can be used, because it is handled by a parser.
Within a MDB Definition Queries are generated with square brackets around column names (e.g. [GTYPE_ID] = 100). Within a SDE the same Definition Queries do not work. The square brackets have to be removed. In a MDB it also works without square brackets.
During updating data sources of Map Displays by the UT Administration Tools "Switch Data Sources of all Map Views" in ArcMap, the square brackets are removed. For Definition Queries in Annotations this is not the case.
- unfavorable: [GTYPE_ID] = 100 AND [STATUS] = 3
- recommended: GTYPE_ID = 100 AND STATUS = 3