ERROR

No column name was specified for column [n] of 'a'

Last Published: April 26, 2020

Error Message

When validating SQL with a computed column in a Query Layer in SQL Server, the following error may occur.

Underlying DBMS error: ~ No column name was specified for column [n] of 'a'.

Cause

A column alias is not specified for a computed column.

When a query layer is initially created, the user defined query is utilized as a sub-query to select the geometry column.

For example:

Code:
SELECT objectid, shape.STConvexHull() as shape2 FROM sde.mySpatialTable

A database trace returns:

Code:
exec sp_prepare @p1 ...,N'select shape2 from (SELECT objectid, shape.STConvexHull() as shape2
FROM sde.mySpatialTable) a',1

If an alias is not provided for the STConvexHull() computed column in the Query Layer dialog, such as in the case below:

Code:
SELECT objectid, shape.STConvexHull() FROM sde.mySpatialTable


an error occurs.

Underlying DBMS error [[Microsoft][SQL Server Native Client 10.0][SQL Server} 
No column name was specified for column 2 of 'a'.]

Solution or Workaround

Ensure computed columns receive a column alias. See the example below.


Code:
SELECT shape.STConvexHull() AS MyConvexHull FROM MySpatialTable;

Article ID:000012401

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic