Creating Tables in Microsoft SQL Server 2008

Woman sitting in office at desk.
Kelvin Murray/Getty Images

SQL Server databases rely upon tables to store data. In this tutorial, we'll explore the process of designing and implementing a database table in Microsoft SQL Server.

The first step of implementing a SQL Server table is decidedly non-technical. Sit down with a pencil and paper and sketch out the design of your database. You'll want to ensure that you include appropriate fields for your business needs and select the correct data types to hold your data.

Make sure to become familiar with database normalization basics before delving into creating tables in Microsoft SQL Server.

01
of 06

Start SQL Server Management Studio

SQL Server Management Studio
Mike Chapple

Open Microsoft SQL Server Management Studio (SSMS) and connect to the server where you'd like to add a new table.

02
of 06

Expand the Tables Folder for the Appropriate Database

SSMS Tables Folder
Mike Chapple

Once you've connected to the right SQL Server, expand the Databases folder and select the database where you'd like to add a new table. Expand that database's folder and then expand the Tables subfolder.

03
of 06

Start Table Designer

SQL Server Table Designer
Mike Chapple

Right-click on the Tables subfolder and select the New Table option. This will start SQL Server's graphical Table Designer, as shown in the image above.

04
of 06

Add Columns to Your Table

Creating Table Columns
Mike Chapple

Now it's time to add the columns you designed in step 1. Begin by clicking in the first empty cell under the Column Name heading in Table Designer.

Once you've entered an appropriate name, select the data type from the drop-down box in the next column. If you're using a data type that allows different lengths, you may specify the exact length by changing the value that appears in parentheses following the data type name.

If you'd like to allow NULL values in this column, click "Allow Nulls".

Repeat this process until you've added all necessary columns to your SQL Server database table.

05
of 06

Select a Primary Key

Setting the Primary Key
Mike Chapple

Next, highlight the column(s) that you've selected for your table's primary key. Then click the key icon in the taskbar to set the primary key. If you have a multivalued primary key, use the CTRL key to highlight multiple rows before clicking the key icon.

Once you've done this, the primary key column(s) will have a key symbol, as shown in the image above.

If you need assistance, learn how to select a primary key.

06
of 06

Save Your New Table

Don't forget to save your table! When you click the save icon for the first time, you'll be asked to provide a unique name for your table.

Format
mla apa chicago
Your Citation
Chapple, Mike. "Creating Tables in Microsoft SQL Server 2008." ThoughtCo, Dec. 28, 2017, thoughtco.com/creating-tables-in-sql-server-2008-1019882. Chapple, Mike. (2017, December 28). Creating Tables in Microsoft SQL Server 2008. Retrieved from https://www.thoughtco.com/creating-tables-in-sql-server-2008-1019882 Chapple, Mike. "Creating Tables in Microsoft SQL Server 2008." ThoughtCo. https://www.thoughtco.com/creating-tables-in-sql-server-2008-1019882 (accessed January 17, 2018).