Friday, March 30, 2012

How do I make a view read-only

I want to create a view that can not be used for record inserts, updates or
deletes - by anyone, including administrators. Is there an option that can
be used in creating the view so I don't have to go through all the users
setting up deny permissions?http://developer.mimer.com/documentation/html_92/Mimer_SQL_Engine_DocSet/Data_manipulation6.html
"Bev Kaufman" <BevKaufman@.discussions.microsoft.com> wrote in message
news:40734E47-0774-4810-959C-5212C74089A7@.microsoft.com...
>I want to create a view that can not be used for record inserts, updates or
> deletes - by anyone, including administrators. Is there an option that
> can
> be used in creating the view so I don't have to go through all the users
> setting up deny permissions?|||If you don't want to change the view definition you can add an INSTEAD_OF
trigger for INSERT, DELETE and UPDATE that do nothing.
--
Rubén Garrigós
Solid Quality Mentors
"Bev Kaufman" <BevKaufman@.discussions.microsoft.com> wrote in message
news:40734E47-0774-4810-959C-5212C74089A7@.microsoft.com...
>I want to create a view that can not be used for record inserts, updates or
> deletes - by anyone, including administrators. Is there an option that
> can
> be used in creating the view so I don't have to go through all the users
> setting up deny permissions?|||Hi Bev
I really think this should be covered by the permissions you grant to the
view, trying to stop administrators updating the view would just mean only
mean they would need to hit the base tables instead.
John
"Bev Kaufman" wrote:
> I want to create a view that can not be used for record inserts, updates or
> deletes - by anyone, including administrators. Is there an option that can
> be used in creating the view so I don't have to go through all the users
> setting up deny permissions?|||There is nothing you can do to deny administrators rights to your view.
Your best bet is to create an INSTEAD OF TRIGGER that just generates an
error message whenever someone tries to modify the view.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Bev Kaufman" <BevKaufman@.discussions.microsoft.com> wrote in message
news:40734E47-0774-4810-959C-5212C74089A7@.microsoft.com...
>I want to create a view that can not be used for record inserts, updates or
> deletes - by anyone, including administrators. Is there an option that
> can
> be used in creating the view so I don't have to go through all the users
> setting up deny permissions?|||Thank you for all your suggestions. I came up with this solution: I added
DISTINCT to the syntax. Since the select list included the unique
identifier, I get the same view results, but now the view is not editable.
"Bev Kaufman" wrote:
> I want to create a view that can not be used for record inserts, updates or
> deletes - by anyone, including administrators. Is there an option that can
> be used in creating the view so I don't have to go through all the users
> setting up deny permissions?|||Keep in mind that this solution might not always possible. The INSTEAD OF
trigger solution is much more general purpose. Also in many cases, adding a
DISTINCT can have a negative impact on query performance if there is no
guaranteed uniqueness. Does your uniqueifier have a unique index? That is
the only way that SQL Server knows the values are already unique and doesn't
add extra processing for the DISTINCT.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Bev Kaufman" <BevKaufman@.discussions.microsoft.com> wrote in message
news:89E10E73-53AD-466B-93F1-7C8B9E6C3E0F@.microsoft.com...
> Thank you for all your suggestions. I came up with this solution: I added
> DISTINCT to the syntax. Since the select list included the unique
> identifier, I get the same view results, but now the view is not editable.
> "Bev Kaufman" wrote:
>> I want to create a view that can not be used for record inserts, updates
>> or
>> deletes - by anyone, including administrators. Is there an option that
>> can
>> be used in creating the view so I don't have to go through all the users
>> setting up deny permissions?sql

No comments:

Post a Comment