2 thoughts on “Checking for the Existence of Global Temp Table in TSQL”

What I normally do to overcome this issue is to use current date as name for the global temp tables I create today, and only have to remember what it was the latest. For instance today my first global temp table will be named ##tmp170510 if I need to create additional ones they will be suffixed with letters (##tmp170510a, ##tmp170510b, etc) or if there is a query involving many temporal tables for different report stages I use meaningful suffixes (##tmp170510Summary, ##tmp170510ActiveCustomers, and so on)