SQL Serve temporary table

SQL Server supports a temporary table. Temporary tables are those names with a pound sign (#) at the beginning of the table. If the temporary table is not removed when the user disconnects, SQL Server will automatically remove the temporary table. Temporary tables are not stored in the current database, but stored in the system database tempdb.

(1) local temporary table, with a pound sign ( # ) at the beginning of those table names. Only on a local temporary table to create a connection to see these tables.

(2) global temporary tables to two pound sign ( ## ) those that begin with the table name. Global temporary tables can be seen on all connections. If you do not explicitly remove these tables before creating global temporary tables disconnected, as long as all other tasks to stop referring to them, ie remove these tables. When you create a global temporary table is disconnected, new tasks can not refer to them. A current statement is executed, the association between the task table i.e. removed; thus usually, as long as the global temporary table created disconnected, i.e. removed global temporary table.

Guess you like

Origin www.cnblogs.com/mobaiyu/p/11655218.html