---
title: "What is Local and Global Temporary tables in SQL Server?"  
description: "What is Local and Global Temporary tables in SQL Server?"  
author: "Ashutosh Kumar Verma"  
published: 2021-11-10  
updated: 2021-11-10  
canonical: https://www.mindstick.com/forum/156819/what-is-local-and-global-temporary-tables-in-sql-server  
category: "mssql server"  
tags: ["sql server", "sql"]  
reading_time: 1 minute  

---

# What is Local and Global Temporary tables in SQL Server?

What is [Local and Global Temporary](https://www.mindstick.com/forum/157526/what-are-the-differences-between-local-and-global-temporary-tables) [tables in SQL](https://www.mindstick.com/forum/204/count-number-of-tables-in-sql-server) [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)?

## Replies

### Reply by Steilla Mitchel

**SQL [Local](https://www.mindstick.com/forum/546/how-to-create-local-user-in-windows-8) and [Global temporary](https://www.mindstick.com/forum/33544/how-to-create-global-temporary-table-in-sqlserver) table:**

## Local Temporary Table:

Local temporary table is a table that is created when connection is established and appear on a connection. It is closed when the connection is closed. A local temporary table is create with # symbol as prefix. Scope of a local temporary table is inside the session.

Syntax for creating a local temporary table

```
CREATE TABLE #TempTable;
```

## Global Temporary Table;

A Global temporary table is created when connection is created and it shows all the users. It is closed when the connection is closed. A Global temporary is represented with ## symbol before the table name. The scope of the Global temporary table is outside of the session.

Syntax-

```
CREATE TABLE ##TempTable;
```

\


---

Original Source: https://www.mindstick.com/forum/156819/what-is-local-and-global-temporary-tables-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
