• dwain.c (1/13/2014)


    Sean Lange (1/13/2014)


    Of course let's not forget to include the cleanup to drop our temp tables.

    drop table #DEMOGRAPHICS

    drop table #CHARTATTACHMENT

    drop table #NOTES_TEXTDATA

    This is awesome advice. Is that in the referenced article? If not, it should be.

    Do you have any idea how many times I've typed in those nefarious DROPs? Yuck!

    Of course, I do usually throw in a "GO" directive just before them to be sure they get dropped when I code up some kind of syntax or compile error in my solution attempt.

    It isn't mentioned but I agree. I usually just end up commenting out the create and inserts since I can do that with fewer keystrokes than typing in the drop statements. Of course those temp tables will be dropped implicitly when the connection closes. I know you know that but I mention it for the sake of completeness.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/