Create a schema bound view on a non-schema bound view or base table

I need to create a view with an index field. I know that in order to do this the view must be schemabound. The view i am trying to create is based on another view. When i try to create the schema bound view however i get an error message saying that the base view is not schemabound. Unfortunately, the base view is created by a 3rd party application so i don't want to mess with that too much. Is there a way to create a schemabound view based on a table or view that is not schemabound itself.

Error output below.

Cannot schema bind view 'ContactsByProjectID'. 'dbo.A_PROJECTID' is not schema bound.
Yaniv SchiffDirector of Digital Forensics Asked:
Who is Participating?
2 options:

1.> Either make the base view as schema bound too. Just adding WITH SCHEMABINDING into the view definition won't have any impact on the way the base view is being called so you could safely do it.
2.> Create one more copy of the same base view (with some other name) as schema bound view this time and write your view on top of this new view. Even though it is redundancy in terms of code maintenance but it might give you what you want.
You cannot create a view WITH SCHEMABINDING when its definition mentions another view that was not itself created WITH SCHEMABINDING.

So what you could try is create a stage table with the result of the third party view

select * into stagetable from dbo.A_ProjectID

then you create your new view based on the stage table
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.