473,811 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ 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 4970
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,u pdate 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,u pdate 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,u pdate 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,D ELETE 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,u pdate 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 in question: myDataRow = myDataSet.Tables(0).Rows(RowNum) myDataRow(ColumnCount) = Ailment Adapter.UpdateCommand = New OleDbCommand("UPDATE SET F" & ColumnCount & " = '" & Ailment & "' where F1 = " & RowNum & "", Conn)...
1
1586
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 to create one explicitly under relations? Do I cerate an index on both fields? Is there a step by step process I can look at to create one-one relations? 2. Is a view updateable if there is a where clause on one of the fields in the...
2
1673
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 inserting the view using query analyzer. But when I add that view as a "linked" table in access (windows db security dsn-less). Access does not allow me to edit the data from view. Table has Pk have tried indexing view but we use several ntext...
3
1704
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
1458
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 on the view. If i do an update to the view, the update is rewritten to update the father-table.
2
1960
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 stored procedure something like this; Select * from View1 Is that true?
8
3009
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: ======================================================== ======================================================== Server Error in '/' Application. -------------------------------------------------------------------------------- Operation must use an updateable query. Description: An unhandled exception occurred during...
11
3117
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 for Windows or DB2 Table Editor. However, when I try to update from either of these tools, I receive an SQL0150 error. Is there anything I can do to allow the updates, such as update the READONLY value for the view in the catalog table? ...
1
1434
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 have found a quick fix in which I can delete the time key from the table and everything will run fine, but when end users try to change records it will not allow them. It comes up with an error that they cannot save changes and must copy to the...
0
9730
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6893
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.