When I run the following I get 3 indexed columns:
SELECT b.name,
c.name
FROM sys.index_columns a
INNER JOIN sys.indexes b ON a.object_id = b.object_id
AND a.index_id = b.index_id
INNER JOIN sys.columns c ON b.object_id = c.object_id
AND a.column_id = c.column_id
WHERE b.object_id = OBJECT_ID('dbo.MyTableIssue')
AND b.name = 'IX_MyTableIssue_ColId_Col2Id'
Returns:
IX_MyTableIssue_ColId_Col2Id ColId
IX_MyTableIssue_ColId_Col2Id Col2Id
IX_MyTableIssue_ColId_Col2Id ColDate
But when I do a right click, script index as then create to new query window I get the following:
CREATE NONCLUSTERED INDEX [IX_MyTableIssue_ColId_Col2Id] ON [dbo].[MyTableIssue]
(
[ColId] ASC,
[Col2Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO
I'm running SQL Sever 2008. Any advice or direction is greatly appreciated.