Updating Views

  • Hugo Kornelis (2/7/2013)


    paul s-306273 (2/7/2013)


    Steve - 0 points to you for creating a view using 'select *'...

    πŸ˜›

    So how should Steve have made a QotD about the dangers of select * in a view without using select * ???

    +1 - but I note that if a warning about using "SELECT *..." had been added to the explanation, this would have been even more helpful.

  • alex.d.garland (2/7/2013)


    Hugo Kornelis (2/7/2013)


    paul s-306273 (2/7/2013)


    Steve - 0 points to you for creating a view using 'select *'...

    πŸ˜›

    So how should Steve have made a QotD about the dangers of select * in a view without using select * ???

    +1 - but I note that if a warning about using "SELECT *..." had been added to the explanation, this would have been even more helpful.

    ... it is like... "never say never...."

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • This was removed by the editor as SPAM

  • Good question. Thanks.

  • Good question, I learned something.

    Generally I don't ever write views with SELECT * in them.

    but even if I did... If I had to refresh the view, I'd typically just alter the view and leave the code as is... that works too, or did... I haven't written a view with SELECT * in it since before SQL 2005



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Good question!

    I wondered about an ALTER VIEW statement being there as well since altering the view inherently refreshes it, but then recalled that *'s aren't allowed in schema-bound objects. Nice!

  • Nice 1 Steve. However, I don't recommend anyone to use SELECT * FROM in view.

  • Thanks Steve

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Good question, thanks Steve. Definitely highlights an important point when using views.

  • Hugo Kornelis (2/7/2013)


    paul s-306273 (2/7/2013)


    Steve - 0 points to you for creating a view using 'select *'...

    πŸ˜›

    So how should Steve have made a QotD about the dangers of select * in a view without using select * ???

    Good question, great discussion, and learned from both. Hugo has a point you cannot illustrate the problems and pitfalls without illustrating the problem or pitfall. Our teachers use to say "Don't ever say lookin, say looking! " And then some smarty would say "But you just said lookin, why can't we?":-)

    Not all gray hairs are Dinosaurs!

  • alex.d.garland (2/7/2013)


    Hugo Kornelis (2/7/2013)


    paul s-306273 (2/7/2013)


    Steve - 0 points to you for creating a view using 'select *'...

    πŸ˜›

    So how should Steve have made a QotD about the dangers of select * in a view without using select * ???

    +1 - but I note that if a warning about using "SELECT *..." had been added to the explanation, this would have been even more helpful.

    Fair point and added.

  • Nice question, Steve. I knew the answer right away from previous posts in the forums.

    By the way, I remember RBarry Young posted some code that he used to run overnight in order to rebuild all views. The code looked interesting and it made sure when a table was altered its views would be accurate next day. However, I'm unable to find the post. I will do some further search and post the link to it when I find it.

    Saludos,

    "El" Jerry.

    "A watt of Ottawa" - Gerardo Galvan

    To better understand your help request, please follow these best practices.[/url]

  • Got it. Here it is:

    http://www.sqlservercentral.com/Forums/FindPost1349883.aspx

    Saludos,

    "El" Jerry.

    "A watt of Ottawa" - Gerardo Galvan

    To better understand your help request, please follow these best practices.[/url]

  • EL Jerry (2/7/2013)


    Got it. Here it is:

    http://www.sqlservercentral.com/Forums/FindPost1349883.aspx

    Saludos,

    That is a version with some problems (misplaced '[' and ']', misplaced 'with scheamabinding' clause, using [] on identifiers in drop but not on create) which are easily fixed. I don't know whether Barry posted a corrected version later.

    It was an amazing thread - I pity the OP having to put up with a lead who bases his decisions on a vivid imagination with a strong inclination towards fiction.

    Tom

  • L' Eomot InversΓ© (2/7/2013)


    EL Jerry (2/7/2013)


    Got it. Here it is:

    http://www.sqlservercentral.com/Forums/FindPost1349883.aspx

    Saludos,

    Wow, that is a humorous thread! I am glad I don't work with that lead. Talk about misdirection...

Viewing 15 posts - 16 through 30 (of 33 total)

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