Create a temporary table, #代表局部临时表, # #代表全局临时表. What is the specific meaning of a local temporary table and a global temporary table?
For example, the more clear, first look at the local temporary table, "New query", enter the following text inside:
After running, we execute the input in this file: SELECT * from #tempTable, after execution can query the following data:
We opened a new query and named it new Query 2, which is executed in new query 2: SELECT * from #tempTable, which prompts you as follows:
To modify the #temptable in the SQL statement to # #tempTable, execute again according to the above method, you will find that new query 2 no longer prompts for errors, can detect and new query 1 in the same results. Why?=> Local temporary tables are visible only in the current session, and global temporary tables are visible in all sessions.
Note that when you use a global temporary table, do not forget to drop table to drop it. However, you can use local temporary tables without doing so, and the local temporary tables that you create are automatically recycled at the end of the current session.
Temporary table specific usage please refer to http://www.jb51.net/article/23952.htm