Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    21

    Unanswered: does a view refresh itself when i reference it? (was "Question On Views")

    guys, ive never worked with Views before so forgive me.
    i know how to create one, and that it creates a virtual table in memory, but i've got one small question.

    if i create a view:

    CREATE view dbo.myView
    as
    select Distinct FirstName,LastName from SomeTable


    When ever i reference that view, such as
    Select FirstName,LastName
    from myView
    where LastName like 'Jo%'

    does that View Refresh itself??

    in other words does it run each time i Reference it??? or is it static from when i created it.

    Wouldnt it be easier just to use a #TempTable or some other Table thats used to hold a few values?

    thanks for any help
    rik

  2. #2
    Join Date
    Jun 2003
    Posts
    269
    Dont worry man ,view is not static .It always fetch records from base table.It is uptodate unless u r using index on views
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You know - I've always thought that the definition of a view as something like a virtual table as very confusing. When I studied relational databases the chapter on views made an assumption that the reader would be very confused at what differentiated a view from a table and spent line after line emphasising the difference. "No " thought I "I can very well differentiate a view from a table - what the flip is the distinction between a view and a query?"

    The way I tend to think of views (indexed views excluded) is that a view is best thought of as a persistent, optimised, stored query that can usually be treated in the same way that you would treat a table as far as viewing data is concerned. It is, however, just that - a view of the data. As such, it does not store any data itself. Every time you call it it views the data afresh.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jan 2006
    Posts
    21
    thank you guys so much. that's exactly the answer i was looking for.
    thanks again
    rik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •