Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include not available in covering indexes in SQL Server 2008 Express

In MS SQL Server Manager Studio for 2008 Express, the "Included Columns" field is always grayed out in the "Indexes/Keys" window in the Database Diagram designer.

Per the help, this should be available so long as I'm not creating a clustered index.

Further, if I run a query to create the index (which runs fine), the created query doesn't list for the table it was added against.

I don't see anywhere where MS says this feature is unavailable in the Express version.

Any ideas?

Further data:

This is the script that creates the table:

CREATE UNIQUE INDEX IX_SocialTypes_Cover ON ClientSocialTypes(ClientID, SocialTypeID, [Source]) INCLUDE (URLID)

Here is the table gen script (the index is missing):

CREATE TABLE [dbo].[ClientSocialTypes](
    [SocialTypeID] [int] IDENTITY(1,1) NOT NULL,
    [ClientID] [int] NOT NULL,
    [SocialTypeClassID] [tinyint] NOT NULL,
    [Source] [nvarchar](50) NOT NULL,
    [TagCount] [int] NOT NULL,
    [URLID] [int] NULL,
 CONSTRAINT [PK_ClientSources] PRIMARY KEY CLUSTERED 
(
    [SocialTypeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]    
GO

ALTER TABLE [dbo].[ClientSocialTypes]  WITH CHECK ADD  CONSTRAINT [FK_ClientSocialTypes_Clients] FOREIGN KEY([ClientID])
REFERENCES [dbo].[Clients] ([ClientID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[ClientSocialTypes] CHECK CONSTRAINT [FK_ClientSocialTypes_Clients]
GO

ALTER TABLE [dbo].[ClientSocialTypes]  WITH CHECK ADD  CONSTRAINT [FK_ClientSocialTypes_SocialTypeClasses] FOREIGN KEY([SocialTypeClassID])
REFERENCES [dbo].[SocialTypeClasses] ([SocialTypeClassID])
GO

ALTER TABLE [dbo].[ClientSocialTypes] CHECK CONSTRAINT [FK_ClientSocialTypes_SocialTypeClasses]
GO

ALTER TABLE [dbo].[ClientSocialTypes] ADD  CONSTRAINT [DF_ClientSocialTypes_SocialTypeClassID]  DEFAULT ((1)) FOR [SocialTypeClassID]
GO

ALTER TABLE [dbo].[ClientSocialTypes] ADD  CONSTRAINT [DF_ClientSocialTypes_TagCount]  DEFAULT ((0)) FOR [TagCount]
GO

ALTER TABLE [dbo].[ClientSocialTypes] ADD  CONSTRAINT [DF_ClientSocialTypes_HasTrackedURL]  DEFAULT ((0)) FOR [URLID]
GO
like image 418
IamIC Avatar asked Nov 12 '10 17:11

IamIC


1 Answers

There's TWO different index dialogs. An ancient horrible awful one, and a new (only just discovered it) one that actually lets you change these things.

OLD HORRIBLE ONE

  • Right click on a table in your main tables list
  • Click 'Design'
  • Right click on the list of columns and select 'Indexes/Keys'

This doesn't let you change included columns.

NEW NICE ONE

  • Expand the table in your main tables list to show the 'Columns', 'Keys', 'Constraints', 'Triggers' etc folders
  • Expand the Indexes folder
  • Right click Indexes folder for New Index
  • Right click existing index and click Properties to edit an existing index

This newer dialog allows you to do a lot more and I'm kind of disappointed in Microsoft for keeping the old one alive and for how long it's taken me to discover it.

like image 188
Simon_Weaver Avatar answered Oct 23 '22 15:10

Simon_Weaver