Is there anybody familiar with indexed view here?
Can I add a foriegn key on a indexed view to reference other table?
Thanks!
No, and you wouldn't want to. Put the constraint on the table - that's the real data. The view is just that - a view, on the data in the table. The fact that you can index the view doesn't change that. You can use INSTEAD OF triggers on views to get things to happen when data is modified through the view but that wouldn't replace a foreign key constraint, rather it would be subject to the constraint as it should be.
No comments:
Post a Comment