D
Time tables are two types. The variable(@Table) tables, the time tables (#table), there are still tables of species ##table, different from #table visibility.In this regard, a brief description may be given:The variable plates are stored in operational memory (if sufficient). Available in the code block, i.e. it can be reused in different requests, has a local area of visibility, as is any other local variable.Time tables. Store in tempdb, have a wider area of visibility, that is, the whole set of challenges. That is, if procedure A created table #A, then triggered procedure B, which created table #B - both A has access to #B (after challenge B) and B has access to #A. In addition, indexes, triggers and others, different from the variable tables, can be created on time tables.
Tables ##Table have a global visibility area. If anyone has set up a table ##Table, they see it all sessions, and it exists as long as "live" is one session that came to this table.Check. There's a vibration area just inside. one Request! I mean, you can't reuse the result. In fact, if you're referring to the TE a few times inside the same question, it will be. as many times as possible! There are undocumented ways to force the optimist to remember the STE in the operational memory for reuse, but this is another story:Courage. Anyway, it's a little different opera... The trainers allow for the rapid processing of data and are not intended for storage. Inside the courser, procedures may be required, which cannot be requested.I'll add my subjective mind when you need to use it.The tables are variable. When you need to use a small amount of data. For example, the intermediate result of a difficult request to record a variable in the table, thus breaking a complex request for two simple ones.Time tables. When the information is quite large and/or it needs to be transferred to another location. These tables are no different from the usual tables, except that there is no need to worry about their cleansing and removal.TE - when no time tables can be used, i.e. places that require us to use only one SQL request, Like, inside the body, a tabular function.The cursors are when you can't take other forms. For example, when each line of the interim result needs to proceed with a stored procedure. MS SQL cadets usually operate slower than requests. So, if there's any chance, it's better to avoid them.