What does the SQL # symbol mean and how is it used?

Saajid Ismail picture Saajid Ismail · Jul 2, 2010 · Viewed 50.9k times · Source

Can someone please explain to me what the # symbol means in MS SQL Code.

I've tried Googling it, and even searching on StackOverflow, but can't seem to find the answer.

I feel like an idiot - having one of "those" days. Please help.

Answer

Ed Guiness picture Ed Guiness · Jul 2, 2010

They normally prefix temporary tables.

From the docs....

Prefix local temporary table names with single number sign (#table_name), and prefix global temporary table names with a double number sign (##table_name).