I am trying to create a SQL view to count the number of point features in a polygon. The following code works when run in a SQL Query, however when I try to create a view using the code I get "Shape.STContains is not allowed, and the column name dbo could not be found or is ambiguous"
SELECT POLYGON.NAME, Count(*)
from Point JOIN
POLYGON
On POLYGON.Shape.STContains(POINT.SHAPE) = 1
GROUP BY POLYGON.NAME
Any assistance would be appreciated.