Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently saw a statement like:


I wanted to know what is the purpose of the symbol # (NUMBER SIGN, hash, pound sign) in this statement?

share|improve this question
The CREATE TABLE documentation is very helpful... – Mark Sinkinson Jul 11 '14 at 10:47
Why both the MySQL and SQL Server tags? – Martin Smith Dec 10 '15 at 18:05
I wonder why this question needs a [mysql] tag, a year after the question has been answered and answer accepted. The # sign is not used in mysql temporary table names. What's the point of adding this tag? It only adds confusion. – ypercubeᵀᴹ Dec 10 '15 at 18:41
There is no compelling need to do so but this also covers up mysql. It will help future readers. – student Dec 11 '15 at 5:24
up vote 11 down vote accepted

'#' denotes a temporary table.

This tells SQL Server that this table is a local temporary table. This table is only visible to this session of SQL Server. When I close this session, the table will be automatically dropped.

You can treat this table just like any other table with a few exceptions. The only real major one is that you can't have foreign key constraints on a temporary table.

Temporary tables are available in MySQL version 3.23 onwards. If you use an older version of MySQL than 3.23, you can't use temporary tables, but you can use heap tables.

Read about usage and syntax here.

share|improve this answer
Accepted as answer - extra info never hurts – student Jul 17 '14 at 15:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.