Create a table called #test and create a table called test in tempdb, what's the difference?

In SQL Server 2005 (2008 not tested) you cannot create a temporary function like #function_name , but you can create a functoin called function_name directly in Tempdb . Does the function thus create a temporary function? What is the difference between the #table_name table and the same named table created directly in tempdb ?

+3
source share
2 answers

The temporary table (#test) is not actually called #test in the tempdb database. This is due to the fact that each user of the system can create a table called #test. If you create a temporary object, a physical object in the tempdb database (found by looking at the sys.all_objects directory view). In my case, it was created as "#test _______________________________________________________________________________________________________________ 000000000003". Where, if you create a physical table in the tempdb database, it is called a test, and only one of them can create an object at a time, and if several users put data in a physical table called a test, they will be able to access other data, Where, when you have temporary tablesusers can only access their own data and their own table.

+4

, , , - , . tempdb, , , , - .

+3

Source: https://habr.com/ru/post/1755203/


All Articles