Unix Technical Forum

view

This is a discussion on view within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi friend ! i want to ask you about view. will the view data be updated automatically when we ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:43 PM
Phung
 
Posts: n/a
Default view

Hi friend ! i want to ask you about view. will the view data be
updated automatically when we insert or update the physical table or
it is updated when we execute the view ?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:43 PM
Roy Harvey (SQL Server MVP)
 
Posts: n/a
Default Re: view

On Mon, 22 Oct 2007 05:26:37 -0700, Phung <purwa@purwadhika.com>
wrote:

>Hi friend ! i want to ask you about view. will the view data be
>updated automatically when we insert or update the physical table or
>it is updated when we execute the view ?


The view data IS the table data. When you reference a view in a
SELECT, the SELECT command inside the view and the SELECT (or other
command) using the view are combined into a more complex SELECT, and
the underlying tables are read.

Roy Harvey
Beacon Falls, CT
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:43 PM
ZeldorBlat
 
Posts: n/a
Default Re: view

On Oct 22, 8:26 am, Phung <pu...@purwadhika.com> wrote:
> Hi friend ! i want to ask you about view. will the view data be
> updated automatically when we insert or update the physical table or
> it is updated when we execute the view ?


Neither. The contents of a view are not stored, so there is no
"updating" to be done. Just know that when you select from the view
it will always reflect the current state of the base tables at that
moment.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 03:43 PM
Roy Harvey (SQL Server MVP)
 
Posts: n/a
Default Re: view

>On Oct 22, 8:49 pm, "Roy Harvey (SQL Server MVP)"
><roy_har...@snet.net> wrote:
>> On Mon, 22 Oct 2007 05:26:37 -0700, Phung <pu...@purwadhika.com>
>> wrote:
>>
>> >Hi friend ! i want to ask you about view. will the view data be
>> >updated automatically when we insert or update the physical table or
>> >it is updated when we execute the view ?

>>
>> The view data IS the table data. When you reference a view in a
>> SELECT, the SELECT command inside the view and the SELECT (or other
>> command) using the view are combined into a more complex SELECT, and
>> the underlying tables are read.
>>
>> Roy Harvey
>> Beacon Falls, CT

>
>thank you. that means the process is done when we select the view.
>but, if i want "updating" then i should create a trigger or stored
>procedure to update the data stored in a table instead of a view, is
>it right ?


Please keep the discussion the news group, not email.

Some views can be updated, but it is more usual to update the
underlying table. Certainly triggers can only be placed on a physical
table, and I would normally only update physical tables.

Roy Harvey
Beacon Falls, CT
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:29 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com