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.
1 2 3 4 5 |
CREATE TABLE InlineIndex ( Name VARCHAR (25) NULL, Surname VARCHAR (25) NULL, Salary BIGINT, INDEX IX_Salary NONCLUSTERED (Salary)) |