Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of "#" in front of a table name in TSQL?

what is the difference between the table names "#mytable" and "mytable" in TSQL? I see table names start with "#" in a lot of custom procedures.

like image 511
Lloyd Banks Avatar asked Aug 01 '12 19:08

Lloyd Banks


People also ask

What is the meaning of :/?

What Does :/ Mean? :/ is an emoticon used to indicate indecision, skepticism, exasperation, and annoyance. The emoticon :/ is one of the most difficult to define. It can indicate a wide range of emotions, including (but not limited to) indecision, skepticism, exasperation, and annoyance.

Whats does 3 mean?

Definition of three 1 : a number that is one more than 2 — see Table of Numbers. 2 : the third in a set or series the three of hearts. 3a : something having three units or members. b : three-pointer. Other Words from three More Example Sentences Phrases Containing three Learn More About three.

What is a number of meaning?

Definition of a number of : more than two but fewer than many : several There are a number of different options to choose from.


2 Answers

These are local temporary tables which are private to the process that created them.

like image 179
mykola Avatar answered Oct 12 '22 15:10

mykola


#mytable is a temporary table where as mytable is a concrete table.

You can read more about Temporary Tables in SQL Server.

They are used most often to provide workspace for the intermediate results when processing data within a batch or procedure. They are also used to pass a table from a table-valued function, to pass table-based data between stored procedures or, more recently in the form of Table-valued parameters, to send whole read-only tables from applications to SQL Server routines, or pass read-only temporary tables as parameters. Once finished with their use, they are discarded automatically.

Temporary tables come in different flavours including, amongst others, local temporary tables (starting with #), global temporary tables (starting with ##), persistent temporary tables (prefixed by TempDB..), and table variables.(starting with (@)

like image 30
YetAnotherUser Avatar answered Oct 12 '22 16:10

YetAnotherUser