Domains in a geodatabase in SQL Server
Domains are rules applied to a field in a business table. They enforce data integrity by allowing only those values specified for the domain to be entered into the field. Domains are defined for the geodatabase and can be applied to multiple feature classes, tables, or subtypes.
There are two types of domains you can define—range domains and coded domains. Range domains can only be applied to numeric fields. For an explanation of domains, see A quick tour of attribute domains.
Domains in ArcGIS Desktop
The domains for a geodatabase are accessed in the Catalog window through the Database Properties dialog box. Right-click the geodatabase, and click Properties.
In the previous example, the list of all the domains defined for a geodatabase are listed at the top of the dialog box. The Fitting_type domain is selected in the list. The Domain Properties and Coded Values shown pertain to this selected domain. As shown in the Domain Properties, the Fitting_type domain is a coded domain.
When a domain is applied to a subtype, it will be listed in the Subtype tab of the Feature Class Properties dialog box. Right-click the feature class and click Properties.
The Fitting_type domain is being applied to the SUBTYPE field of the Fittings feature class.
When you edit the attributes of the Fittings feature class in ArcMap, you can only enter one of the codes specified for the Fitting_type domain in the SUBTYPE field.
Domains in a SQL Server DBMS
In the database, all domains are stored in the GDB_ITEMS system table. A field in the GDB_ITEMTYPES table identifies the object as a domain.
Domains in an XML workspace document
Domains in XML workspace documents are enclosed with a Domain tag.
The following is a portion of an XML workspace document that contains the definition of the Fitting_type coded value domain:
<Domain xsi:type="esri:CodedValueDomain"> <DomainName>FittingType</DomainName> <FieldType>esriFieldTypeString</FieldType> <MergePolicy>esriMPTDefaultValue</MergePolicy> <SplitPolicy>esriSPTDuplicate</SplitPolicy> <Description>Valid fitting type codes</Description> <Owner>RJP</Owner> <CodedValues xsi:type="esri:ArrayOfCodedValue"> <CodedValue xsi:type="esri:CodedValue"> <Name>Tee</Name> <Code xsi:type="xs:string">TEE</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Sleeve</Name> <Code xsi:type="xs:string">SLV</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Reduser</Name> <Code xsi:type="xs:string">RED</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Expansion joint</Name> <Code xsi:type="xs:string">EOP</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Cross</Name> <Code xsi:type="xs:string">CRS</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Bend</Name> <Code xsi:type="xs:string">BEND</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Cap</Name> <Code xsi:type="xs:string">CAP</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Coupling</Name> <Code xsi:type="xs:string">CPL</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Offset</Name> <Code xsi:type="xs:string">OFF</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Plug</Name> <Code xsi:type="xs:string">PLG</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Saddle</Name> <Code xsi:type="xs:string">SDL</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Tap</Name> <Code xsi:type="xs:string">TAP</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Weld</Name> <Code xsi:type="xs:string">WLD</Code> </CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Riser</Name> <Code xsi:type="xs:string">RIS</Code> </CodedValue> </CodedValues> </Domain>
The entries for a range domain, RotAngle, in an XML workspace document are shown here:
<Domain xsi:type="esri:RangeDomain"> <DomainName>RotAngle</DomainName> <FieldType>esriFieldTypeInteger</FieldType> <MergePolicy>esriMPTDefaultValue</MergePolicy> <SplitPolicy>esriSPTDuplicate</SplitPolicy> <Description>Valid rotation angles</Description> <Owner>RJP</Owner> <MaxValue xsi:type="xs:double">359</MaxValue> <MinValue xsi:type="xs:double">0</MinValue> </Domain>