There are two type of temporary tables in SQL Server: local and global temporary tables.
1. Local temporary #tables
If a database session creates the local temporary table #employees, only the session can work with the table, and it is deleted when the session disconnects.
2. global temporary ##tables
If no other user works with this table after you create it, the table is deleted when you disconnect.
If another user works with the table after you create it, SQL Server deletes it after you disconnect and after all other sessions are no longer actively using it.
450 total views