create temp view

  • Thomas Rushton

    SSC-Insane

    Points: 22624

    Jeff Moden - Sunday, May 20, 2018 11:43 AM

    jawahar11088 - Sunday, May 20, 2018 7:42 AM

    No create temporary view.

    I tried temporary procedure.

    And???

    10 year old thread.  @jawahar11088 - maybe ask a new question, rather than resurrect this one?

    Thomas Rushton
    blog: https://thelonedba.wordpress.com

  • Jeff Moden

    SSC Guru

    Points: 995164

    ThomasRushton - Monday, May 21, 2018 3:05 AM

    Jeff Moden - Sunday, May 20, 2018 11:43 AM

    jawahar11088 - Sunday, May 20, 2018 7:42 AM

    No create temporary view.

    I tried temporary procedure.

    And???

    10 year old thread.  @jawahar11088 - maybe ask a new question, rather than resurrect this one?

    Heh... I don't mind someone piggy backing on a 10 year old thread because it usually enriches the thread.  But, holy moly, what's the question here?  There's absolutely no amplifying information to even think of what can be done as an alternative.  Worse yet, is it a question or advise to someone to use a "temporary procedure"?  I also state that's probably a mistake but don't have enough info to actually say so.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

    Helpful Links:
    How to post code problems
    Create a Tally Function (fnTally)

  • jcelko212 32090

    SSCrazy Eights

    Points: 8882

    Donald Leaderach - Thursday, March 13, 2008 6:56 AM

    Is it possible to create a temporary view from within a stored procedure for the life of the stored procedure. I do have a way of doing it now where I create the view and at the end it is removed but there is an issue with giving the user dbo authority in order to do this. Plus it physically write and removes the view.Creating Temp views allows for the more flexibility vs creating numerous permanent views.Any help would be appreciated.

    I think you've missed the purpose of views in SQL. You're trying to mimic what would've been a scratch tape back in the 1950s on the file system! Your COBOL or FORTRAN program would've instructed the operator to mount a tape on available drive, read and write to it, and then to dismount the tape and return it to general storage.

    In the relational world, a view is a virtual table, just as real as a base table. They're not allocated/ deallocated like scratch tapes. In fact, you saw the DBO authority problem when you have the wrong view of how the language works. Have you ever worked in SQL shop everybody had system admin privileges? You never step into the same database twice because it's always changing!

    SQL is a declarative language, not a procedural language. That means you tell us what you want in logical terms and you do not procedurally build it row by row. It's a very different mindset. If you post some of your code, we might be able to help you rewrite it.

    Please post DDL and follow ANSI/ISO standards when asking for help. 

Viewing 3 posts - 16 through 18 (of 18 total)

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