Site icon Database Tutorials

How To Create a Table in SQL Server

 

We will create a table in SQL Server by using two methods in this article.

First Method (With SSMS):

Right-click on the corresponding database as follows to create the table using SSMS. Then click “New and Table …” on the Tables tab.

We enter the column names that we want to have in the table as shown in the Columns section below. In the Data type section, we determine the data types of the columns. In the Allow Nulls section, we determine whether the corresponding column can receive a null value.

You can find detailed information about SQL Server data types in the article “SQL Server Data Types”.

You can save the table with Ctrl + s keys.

Or you can get the script of the operations you have done to create the table by clicking on Table Designer and Generate Change Script as follows.

Second Method (With TSQL):

We can create a table with the help of the following script.

You can add some features to the table when creating a table. I have listed some of these features below.

Exit mobile version