SELECT name FROM sys.indexes WHERE is_primary_key = 0 AND OBJECT_name(object_id) = 'ArchiveRetrieval'>I need to verify that script which is used to select the indexes from a table. I thought I had it running ok but it is not the case. This script doesn't find any of my indexes on a table. I do have some so I guess something need to be adjusted.
>DECLARE tableIndexes CURSOR LOCAL FOR >SELECT name FROM sysindexes >WHERE id = OBJECT_ID(N'ArchiveRetrieval') AND > indid > 0 AND indid < 255 AND > INDEXPROPERTY(id, name, 'IsStatistics') = 0 AND > name <> (SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS > WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' AND TABLE_NAME = '[ArchiveRetrieval]') >ORDER BY indid DESC >>