You attempted to publish a query layer defined by a complex SQL query to a feature service.
Do one of the following:
- If editing is not required, publish a map service instead of a feature service.
- If editing and, therefore, a feature service are required, simplify the SQL query defining your query layer by removing complex elements such as joins or WHERE clauses. An example of a simple query is as follows:
SELECT id, statename, population, shape FROM mydb.myuser.US_States
- If the data from the query layer is not needed in the resultant feature service, remove it from the map before publishing.
A query layer is a layer or stand-alone table defined by an SQL query. Query layers allow you to integrate both spatial and nonspatial information stored in a database management system into GIS projects within ArcMap.
When working in ArcMap, you create query layersby defining an SQL query. The query is then run against the tables and views in a database, and the result set is added to ArcMap as a layer or stand-alone table (depending on whether the query includes a spatial field).
When you publish a feature service to ArcGIS Server, the SQL query that defines the query layer must be simple. A simple query can contain a subset of the fields in the table—for example, SELECT objectid, shape FROM mydb.myuser.US_States—but WHERE clauses and joins are not supported when publishing a feature service. For instance, you cannot publish a query layer that selects a subset of rows using a WHERE clause.