Is This Content Helpful?
We're glad to know this article was helpful.
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'.
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.
SELECT objectid, shape.STConvexHull() as shape2 FROM sde.mySpatialTable
exec sp_prepare @p1 ...,N'select shape2 from (SELECT objectid, shape.STConvexHull() as shape2
FROM sde.mySpatialTable) a',1
SELECT objectid, shape.STConvexHull() FROM sde.mySpatialTable
Underlying DBMS error [[Microsoft][SQL Server Native Client 10.0][SQL Server}
No column name was specified for column 2 of 'a'.]
Ensure computed columns receive a column alias. See the example below.
SELECT shape.STConvexHull() AS MyConvexHull FROM MySpatialTable;