You are here: Re: views not updateable « MsSQL Server « IT news, forums, messages
Re: views not updateable

Posted by Damien on 03/23/07 15:15

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация