In SQL Server, what is the difference between a @ table, a # table and a ## table?
#table refers to a local (visible to only the user who created it) temporary table. ##table refers to a global (visible to all users) temporary table.
Comparing the Results of the Two Queries Let us suppose, we have two tables: table1 and table2. Here, we will use UNION ALL to combine the records based on columns that need to compare. If the values in the columns that need to compare are the same, the COUNT(*) returns 2, otherwise the COUNT(*) returns 1.
SQL Server DIFFERENCE() Function The DIFFERENCE() function compares two SOUNDEX values, and returns an integer. The integer value indicates the match for the two SOUNDEX values, from 0 to 4. 0 indicates weak or no similarity between the SOUNDEX values.
#table
refers to a local (visible to only the user who created it) temporary table.
##table
refers to a global (visible to all users) temporary table.
@variableName
refers to a variable which can hold values depending on its type.
Have a look at
#
and ##
tables are actual tables represented in the temp database. These tables can have indexes and statistics, and can be accessed across sprocs in a session (in the case of a global temp table, it is available across sessions).
The @table is a table variable.
For more: http://www.sqlteam.com/article/temporary-tables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With