O
O
one__for__one2016-02-25 17:21:40
SQL Server
one__for__one, 2016-02-25 17:21:40

How to set a key in a view?

I connect two tables in representation in both tables there are keys. How to set a key in a specific column in a view?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tommy87, 2016-06-20
@one__for__one

You need a materialized view, i.e. first create a cluster key on the view, then the desired key, you can combine this in one action.
Here about it:
https://msdn.microsoft.com/ru-ru/library/ms191432.aspx
But it is worth considering the pitfalls, for example, when updating one table, the view will also be updated. It will also not be so easy to change the structure of the tables that will be used in this view. There is more at the link above.

P
Prk11, 2016-02-26
@Prk11

No way, this is a view, not a table, why are there keys?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question