Where Do Temporary Tables Get stored in sql server?

Shantanu Gupta picture Shantanu Gupta · Jun 10, 2010 · Viewed 40.1k times · Source

Where do temporary tables get stored in a database? I want to drop a temporary table if it already exists. I can do this for securable tables by querying at information schema but I don't know where temporary tables are stored.

Answer

Giorgi picture Giorgi · Jun 10, 2010

Temporary tables are stored in tempdb Database. There are various ways to check if a temp table exists outlined here: Check If Temporary Table Exists.