Temp Tables

  • Scott,

    a restart includes a shutdown and startup of the instance.

    a shutdown and startup of the instance is not a restart.

    They are not equivalent. The restart is a part of configuration manager and the services applet, as a way to shutdown and startup the instance in one step. In terms of a DBA, that is what I would use the term for, and what I've heard many others use the term for. Any shutdown because of a disaster, is not part of a restart.

  • Being editor gives you the power to make up definitions on a whim, but it doesn't make you right.

    For instance, in Books Online in the "Moving System Databases" topic, they use "restart" to mean only what you are calling "startup"

    For each file to be moved, run the following statement.

    ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name , FILENAME = 'new_path\os_file_name' )

    Stop the instance of SQL Server or shut down the system to perform maintenance. For more information, see Stopping Services.

    Move the file or files to the new location.

    Restart the instance of SQL Server or the server. For more information, see Starting and Restarting Services.

    I have never met a DBA/sysadmin who would not understand the use of the word "restart" in those instructions, and I don't recall hearing anyone plan an outage for maintenance that did not use the word the same way. How many times have you read that page in Books Online yourself, and did it ever bother you that they used the word "restart" instead of start or startup?

  • Nothing personal but...

    Semantics... "When all active tasks have stopped referencing them"... you've combined two requirements and are testing to see if the test taker agree's with your subjective change in the definition or not. From BOL...

    Global temporary tables are automatically dropped when the session that created the table ends [font="Arial Black"]and[/font] all [font="Arial Black"]other [/font]tasks have stopped referencing them

    "When all active tasks have stopped referencing them" sounds like that because you simply say "all" instead of "all other". The problem is, I can have an active task (the session that created the GTT) that is no longer "referencing" the GTT as part of an active query but unless the session that created the GTT drops, that GTT will still continue to "live". It's all in the semantics surrounding the test question writer's definition of what "referencing" actually means and whether the test taker can guess the test writer's definition correctly.

    Heh... two pork chops for a bad test answer. 😛

    --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.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Steve Jones - Editor (12/17/2009)


    I would agree that #2 is a little incomplete. That answer has been edited and points are being awarded back to everyone that has answered to date.

    4 is horribly incomplete: if the table is explicitly dropped, it still continues to exist until all queries referencing it have completed, so 4 should not be ticked - but the answer says it should be. Now are you going to revise the points again? I think you should have a fixed policy - either never revise or always revise - and always revise would probably be rather painful to execute.

    Tom

  • I shall disrgard this question and award points to everyone as well as mark a future "THis is correct answer.

    I still disagree with the restart. In that content, the "restart" is delayed, but that procedure implies that have stopped the service, so a restart is "starting it again". It's not starting from scratch, which I guess only ever happens once. I see your point, and perhaps we just have different ways of viewing things.

    The answers are not intended to be completely correct in all cases. They are options. The creator dropping the table is one way that it can be dropped. However I see where some people would interpret it a different way.

  • vk-kirov (12/17/2009)


    It would be much better if the options #2 and #3 where not separated from each other. Neither #2 nor #3 in itself does not trigger SQL Server to drop the global temporary table.

    I think these options look better:

    - When the instance restarts

    - When the session that created it ends and all active tasks have stopped referencing them

    - When specifically dropped by name

    -----

    To those people who answered '1,3,4': is the condition 'all active tasks have stopped referencing them' sufficient for dropping the table? The answer is 'No, it is not'. If the session that created the table still exists, the table remains even if that session is not active. So, if #2 is intended to be marked as incorrect, #3 should be marked as incorrect too.

    (By the way, I also answered '1,3,4' 🙂 )

    Exactly right. 2 and 3 go together. One without the other does mean the table will be dropped. All connections to the table must be deleted, whether by session or task before the table will be dropped. 1 and 4 will always drop the table.

    Great question. Answers need a little refinement.

    Peter Trast
    Microsoft Certified ...(insert many literal strings here)
    Microsoft Design Architect with Alexander Open Systems

Viewing 6 posts - 31 through 35 (of 35 total)

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