• TheSQLGuru (1/16/2014)


    Why do you want a script to do this? Temp objects are automatically "managed" by the engine. Just close the connection and you don't have to worry about them. IIRC explicit drops aren't even honored any longer...

    Unless that changed for 2014, they are. The #temp drop functions for batch code. IE: Strip the query out of its procedure and put that on top so you can rerun while doing performance testing/data validation.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA