T-SQL # vs. C Temporary Data Comparison

I have been working with basic SQL for a couple of years now. However, only recently I came across the "C" team. From my research, it seems that "WITH" is a method of creating a temporary table. But in my experience, you can also use the hash "#" to create a temporary table.

I tried to find "WITH" and "#", but since these are strange search words, I do not get much result.

Can someone listen to me depending on what is the difference, for example, the pros and cons for each?

+5
source share
2 answers

You use WITHto create a general table view (CTE). This is not technically a temporary table.

, tempdb .

temp, CTE . "".

, CTEs. , , CTE:

SELECT, INSERT, UPDATE, DELETE CREATE VIEW

MSDN

+4

WITH - , " " ( ), , (#) , , . ,

0

All Articles