I’m new to sql server. i used to be making an attempt to study creating index. i attempted to create a desk with under question:
CREATE TABLE [Ref].[Country]( [CountryId] [uniqueidentifier] NOT NULL, [CountryName] [varchar](50) NOT NULL, [CreatedDate] [datetime2](2) NOT NULL, [ModifiedDate] [datetime2](2) NULL, CONSTRAINT [UCI_CountryName] UNIQUE CLUSTERED ([CountryName] ASC), CONSTRAINT [PK_Country] PRIMARY KEY ([CountryId]) )
The non clustered index bought created mechanically on main key. Now, i wish to create NCI on Major key column with INCLUDE. I did create it with under question:
CREATE UNIQUE NONCLUSTERED INDEX [NCI_CountryId] ON [Ref].[Country] ( [CountryId] ASC ) INCLUDE ([CountryName])
As you may see in under picture, there’s two NCI on similar column that’s CountryId, one is created by default whereas making a desk(PK_Country) and one other which i created with INCLUDE utilizing above question(NCI_CountryId).
I don’t need two NCI’s on similar column, want solely NCI created with INCLUDE. Is there a option to create NCI with embrace on PK at time of making desk ?
I am engaged on sql server on Azure VM.