@tablename vs #tablename

  • Can someone explain the difference between using @myTable Table

    and #myTable and why would I choose one over the other

  • Here you go:

     


    * Noel

  • Nevermind

     

  • ok Ray - now I see where you got your black eye - good thing Remi's on vacation - else it might've been 2 (black eyes ie)..

    btw - you are not Ray Martinez revisiting the site as Ray M are you ?!?! curious because both your styles (t-sql) are so similar...







    **ASCII stupid question, get a stupid ANSI !!!**

  • well, black eye ... sounds too painful

    and if I have to guess I would say is the SAME person

     


    * Noel

  • Yeah, one and the same.

    Just shortened my name to protect the innocent.

    I didn't realize I had any style.

    Just dreaming of the day when I get to 500 Posts.

  • An additional problem with table variables that I found in practice is that the query processor cannot make use of a parallel query plan with table variables. A procedure ran in under a second on a development server (single processor) but took minutes in production (multi-processor). Simply replacing the table variables with temporary tables fixed it.

  • Inherently sql server handle's memory very well, but the in memory temp tables have some sort of bottleneck. When there are a ton of rows 100's vs 10,000s, Then the use or query of the in memory table becomes very sluggish, it has to do with a bunch of memory swapping it has to do.

    Temporary objects can be avoided in some circumstances and I try to use them sparingly.

    my $0.10, $0.02 is Free

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

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