I have a regular SQL Server view that refers to the planar spatial data type, geometry. When I import this database view into my SSDT project, it throws the following exception:
SQL70561: Cannot schema bind view 'MyView' because name 'geometry' is invalid for schema binding. Names must be in a two-part format and an object cannot reference itself.
It seems like the type geometry is not recognized by my SQL Server Database Project in Visual Studio. My target SQL Server version is 2016.
Here's the Visual Studio screenshot:
TIA
It took me two days to figure it out. So, whenever we have a view containing the clause WITH SCHEMABINDING
it is forced to bind the schema for everything included in the PL/SQL block. In my case, it was trying to look under dbo and couldn't find geometry
there. So, once I specified system schema sys
in front of the geometry
, it was accepted.
Hopefully, it helps someone in the future.