Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2012-08-15
Medium Priority
Last Modified: 2013-02-14
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.
Question by:Yaniv Schiff
LVL 41

Expert Comment

ID: 38297654
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
LVL 12

Accepted Solution

sachitjain earned 1500 total points
ID: 38311059
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.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question