SQL Server uses a special database called tempdb to store temporary tables. Temporary tables in SQL Server are created in tempdb by default. There are two types of temporary tables in SQL Server:
- Local Temporary Tables (
#table_name
): These tables are visible only to the session that created them and are automatically dropped when the session ends. - Global Temporary Tables (
##table_name
): These tables are visible to all sessions and are dropped when the last session referencing the table ends.
Both types of temporary tables are stored in the tempdb database, which is a system database used for temporary storage of data, including temporary tables, intermediate result sets, and internal objects.
No comments:
Post a Comment