What is the reason / benefit of prefixing the creation of a table with # sign

I come across tables being created with pound sign #. For example,

CREATE TABLE #airports
[airport_code] INT,
airport_name VARCHAR(50),
airport_city DATETIME,
airport_state VARCHAR(50)

Can someone let me know what is the reason of creating a table with the # sign?

The # sign is a local temporary table - two # signs is a global temporary table. See the documentation here: CREATE TABLE (Transact-SQL) - SQL Server | Microsoft Learn


Hi Jeff,

Thanks for getting in touch.

So, when you say temporary, does that mean it's only available while I'm access the database? When does it get removed?

ok, I just read the details from the link you provided.

Thank you