473,480 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

views not updateable

How do I make a view non updateable? I want to create a view so that I
will not be able to update, insert or delete the view so that base
table is not affected (except dropping the view itself). Thanks.

Mar 23 '07 #1
4 4948
On Mar 23, 4:06 pm, othell...@yahoo.com wrote:
How do I make a view non updateable? I want to create a view so that I
will not be able to update, insert or delete the view so that base
table is not affected (except dropping the view itself). Thanks.
I have tried:
revoke delete,insert,update on v_t1 to dbo

bit its not working...

Mar 23 '07 #2
On Mar 23, 4:13 pm, othell...@yahoo.com wrote:
On Mar 23, 4:06 pm, othell...@yahoo.com wrote:
How do I make a view non updateable? I want to create a view so that I
will not be able to update, insert or delete the view so that base
table is not affected (except dropping the view itself). Thanks.

I have tried:
revoke delete,insert,update on v_t1 to dbo

bit its not working...
Okay found a solution. If I introduce an aggregate function then it
works. So I ended up aggregating all the columns from the select list.
So instead of saying:
Create view view1 as
Select column1, column2
>From Base_table
Not Updateable:
Create view view1 as
Select column1, column2
>From Base_table
Group by column1,column2

I wish there is an easier way than this.

Mar 23 '07 #3
On Mar 23, 10:34 am, othell...@yahoo.com wrote:
On Mar 23, 4:13 pm, othell...@yahoo.com wrote:
On Mar 23, 4:06 pm, othell...@yahoo.com wrote:
How do I make a view non updateable? I want to create a view so that I
will not be able to update, insert or delete the view so that base
table is not affected (except dropping the view itself). Thanks.
I have tried:
revoke delete,insert,update on v_t1 to dbo
bit its not working...

Okay found a solution. If I introduce an aggregate function then it
works. So I ended up aggregating all the columns from the select list.
So instead of saying:
Create view view1 as
Select column1, column2
From Base_table

Not Updateable:
Create view view1 as
Select column1, column2>From Base_table

Group by column1,column2

I wish there is an easier way than this.
create trigger T_NoUpdates on view1 INSTEAD OF INSERT,UPDATE,DELETE AS
RAISERROR('No updates allowed',16,1)

Damien

Mar 23 '07 #4
On 23 Mar 2007 03:13:01 -0700, ot*******@yahoo.com wrote:
>On Mar 23, 4:06 pm, othell...@yahoo.com wrote:
>How do I make a view non updateable? I want to create a view so that I
will not be able to update, insert or delete the view so that base
table is not affected (except dropping the view itself). Thanks.

I have tried:
revoke delete,insert,update on v_t1 to dbo

bit its not working...
Hi othellomy,

The REVOKE keyword is to revoke a permission that was earlier GRANTed
explicitly.

To explicitly deny access to an object that would by default allow
access, you use DENY:

DENY DELETE, INSERT, UPDATE ON v_t1 TO ALL

However, this will not affect any user in the db_owner database role or
any user in the sysadmin server role, since security checks are bypassed
for these users.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Mar 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
902
by: Tom wilson | last post by:
This is driving me nuts. I'm trying to update an Excel spreadsheet using ADO.Net and Oledb in VB.Net. The connection is open, the adapter is connected and the dataset is loaded. Here's the code...
1
1574
by: John | last post by:
I am hoping to create an updatable view from two tables joined on two fields. I have two questions; 1. How can I enforce a one to one relation in sql server 2005 based on two fields? Do I need...
2
1660
by: abefuzzleduser2 | last post by:
I am using sql 2000 (mdb) with linked tables on SQL 2000. I need to use views to limit users records, instead of direct table access. I setup a single talbe view in sql and tested update and...
3
1685
by: CSN | last post by:
Just wondering, is updateable views slated for a future version of Postgresql? In addition to using rules that is. CSN __________________________________ Do you Yahoo!?
4
1433
by: Sebastian Böck | last post by:
Hello all, i have a view defined as a simple select of a table. This table is inherited by a couple of others. All entries belong to the child-tables. I also have an unconditional update rule...
2
1938
by: dbuchanan52 | last post by:
Hello, I am building an application for Windows Forms using. I am new to SQL Server 'Views'. Are the following correct understanding of their use? 1.) I believe a view can be referenced in a...
8
2985
by: Jim in Arizona | last post by:
I've been using an example out of a book to be able to edit the rows in a database. I am getting the following error: ========================================================...
11
3096
by: JC | last post by:
I created an updateable view, which joins two tables, in a DB2 UDB database. The view was made updateable by the creation of an "instead of" trigger. I'd like to use this view for updates via QMF...
1
1418
by: kia.martin | last post by:
I have a sql database connected with access, but when I try to run macros which basically just transfer information from tables for approval an error comes up with "time key is not updateable". I...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.