Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that SQL Server doesn't support using a view as the reference for a foreign key constraint, is there a reason (i.e. something to do with the relational model) this is the case? It seems like it would be useful....

share|improve this question
I've asked a related question (not the why but how it could be done with other ways): Are there DBMS that allow a Foreign Key that References a View (and not only base tables)? It probably has to do with the complexity of implementing such a feature. The relational model is fine with such a concept. – ypercubeᵀᴹ Nov 30 '12 at 2:52
up vote 9 down vote accepted

There's no fundamental problem with doing this, since tables and views are both relation variables in the relational model. Foreign key constraints are just a particular subclass of general constraints, which standard SQL implements using CREATE ASSERTION so there's no particular SQL language difficulty either.

According to this Connect item it's simply a matter of prioritization. If you would find this feature useful, vote for the item and particularly add details of your use case in the comments.

share|improve this answer
I suspect it would have to be limited to indexed views to be feasible. – Cade Roux Nov 30 '12 at 19:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.