Views

  • Kinda confusing in BOL..

    When is the data in a view refreshed..  never..  everytime it's run..

  • Every time it's run.  Just like any other select statements using any type of objects.

  • This is the view scripted out.

    CREATE VIEW dbo.VW_Genre_Catgry_Shows

    AS

    SELECT     dbo.Shows.Show_No, dbo.Shows.Show_Name, dbo.Shows.Show_Format, dbo.Categories.Category_Code, dbo.Categories.Category_Desc,

                          dbo.Genres.Genre_Code, dbo.Genres.Genre_Desc

    FROM         dbo.Genres INNER JOIN

                          dbo.Categories ON dbo.Genres.Genre_Code = dbo.Categories.Genre_Code INNER JOIN

                          dbo.Shows ON dbo.Categories.Category_Code = dbo.Shows.Category_Code

    When I do a " select from"  against this view, The genre code is wrong for a specific 'show' ... I  know to fix it I need to change the data in the table... NOT in the view..  how do I figure out when table is providing the genre code????

  • The description of the show is wrong for a single show.  Or the description is always wrong (for any show)?

  • The genre code is wrong for a couple of shows.. not all of them

  • Then going in the shows table and set the right code in there.  Then the data will be correct and the view will show the good results.

  • That's kinda what I thought too.. but the shows table does not have a genre column??  only a category column..   The category is correct.. i just can't figure out where it's getting the genre code from ...

  • >>i just can't figure out where it's getting the genre code from

    One of your category table records has the wrong genre_code value.

    A show belongs in a category.

    A category belongs in a genre.

    If you've found a show that is in the correct category, but is not in the correct genre, then the category is in the wrong genre.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply