Follow by Email

Wednesday, May 22, 2013

[Resolved] SQL Error: Cannot schema bind view 'viewName' because name 'tableName' is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.


Error Description:

Msg 4512, Level 16, State 3, Procedure EMPVIEW, Line 4
Cannot schema bind view 'DBO.EMPVIEW' because name 'EMPLOYEE' is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.


Explanation: 
Such an Error occur when we create a view with schema binding and the table name we are using in it is without the schema name.

Add the schema name along with the table name in the script like tableName to dbo.tableName.
Hence it will resolve the error getting generated.

Example:

1
2

3


4