Introduction
In this article, we will learn about the various types of tables in SQL Server. In SQL we can create various types of tables (User table, Temporary table, Global table, etc.) which can be used for various purposes in SQL Server.
We will try to highlight all the major tables in this article. So let's have a look at a practical example of how to create various types of tables in SQL Server. The example is developed in SQL Server 2012 using the SQL Server Management Studio.
The following are the various types of tables in SQL Server.
1. User tables (Regular Tables)
Regular tables are the most important tables. They contain data for later use. Regular tables are storedin the hard drive. If you want to delete these tables from hard drive, you can use a drop command in SQL Server. The following is a sample of creating a regular table:
CREATE TABLE [dbo].[Employee]
(
[EmpID] [int] NULL,
NULL,
[EmpSalary] [int] NULL
)
Now press F5 to execute it.
Output

You can see this table fromObject Explorer -> Database - Tables

2. Local temporary tables
Local temporary tables are the tables stored in tempdb. Local temporary tables are temporary tables that are available only to the session that created them. These tables are automatically destroyed at the termination of the procedure or session. They are specified with the prefix #,
For example #table_name and these temp tables can be created with the same name in multiple windows.
Creating a local temporary table
The following is a sample of creating a local temporary table:
CREATE TABLE #table_name
(
column_name varchar(20),
column_no int
)

3. Global temporary tables
Global temporary tablesare also stored in tempdb. Global temporary tables are temporary tables that are available to all sessions and all users. They have dropped automatically when the last session using the temporary table has been completed. They are specified with the prefix #, for example, ##table_name.






Gowtham RajamanickamPosted Apr 26, 2016, 3:04 AM
good article
Ismail Hakki SenPosted Sep 7, 2014, 4:47 PM
Thanks. Useful article.
Rohatash KumarPosted Nov 23, 2012, 5:36 AM
Thanks. Deepak
Deepak MiddhaPosted Nov 23, 2012, 4:51 AM
Very Nice article sir.