View Not Updatable in SQL Server

Asked

Viewed 126 times

1

How to make a View not upgradable in SQL Server, because I’m not finding documentation that contains such a script.

  • View not upgradable?

  • How so young? What’s the need then?

  • And for the college job, I didn’t understand the need either!

2 answers

1

In the documentation of CREATE VIEW there is something about updatable views and what are the rules for obtaining them. By break some of the rules, it seems to me that we have a non-upgradable display.

For example:

   -- código #1   
   CREATE VIEW nome_da_exibição as  
   SELECT colunas 
     from nome_tabela
   union all  
   SELECT colunas 
     from nome_tabela  
     where 1 = 0;  
   go

It is also possible to use procedure Trigger (type INSTEAD OF) to block execution of INSERT, UPDATE and DELETE in the display call.

To delve into the theme, search the web for sql server view readonly.

  • thanks guys... I think it should be this way that Jose passed on, thank you all!

0

The most performative form I know is:

CREATE VIEW MinhaView
AS
SELECT TOP 100 PERCENT Coluna1, Coluna2, Coluna3
FROM tabela
WITH CHECK OPTION

Browser other questions tagged

You are not signed in. Login or sign up in order to post.