SQL Server – Indexes Not Created on LocalDB

indexsql server

When using localdb and executing this, when browsing the database in sql server object explorer (in visual studio), the index is not created. I have to manually create it to make it appears. Why ?

CREATE TABLE [Instructor] (
    [ID] int NOT NULL IDENTITY,
    [LastName] nvarchar(50) NOT NULL,
    [FirstMidName] nvarchar(50) NOT NULL,
    [HireDate] datetime2 NOT NULL,
    CONSTRAINT [PK_Instructor] PRIMARY KEY ([ID])
);

Best Answer

I don't see any indexes in the Visual Studio object explorer. But if you ran that code, the index is certainly there.

Check with TSQL:

select * 
from sys.indexes
where object_id = object_id('Instructor')

Or connect with SSMS to (LocalDb)\MSSQLLocalDB and check with the SSMS object explorer.