Site icon Database Tutorials

How To Create Index in CREATE TABLE Statement in SQL Server

Before SQL Server 2014, we were able to create an index in two ways by right-clicking on SSMS and clicking new index, or using the tsql script. But we couldn’t create index as we create primary key or foreign key in the CREATE TABLE statement. With SQL Server 2014, we can create the index while creating the table. You can see how we created it in the script below.

Exit mobile version