LISTING 1: Script That Checks for the Existence of an Index on a Specified Table SELECT COUNT(*) FROM sysindexes I, sysobjects O WHERE I.id = O.id AND O.name = 'TableName' AND I.name = 'IndexName'