User receives errors when procedure contains SQL Passthru: ALTER INDEX REBUILD: SQLCODE IS 2727


Diagnostics

Product: DataMigrator
Release: 8206 Release: 7710
Primary OS: Windows
Solution Date:

Symptom

(FOC1400)    SQLCODE IS 2727 (HEX: 00000AA7) XOPEN: 42S21                                             
(FOC1500)    :  Microsoft SQL Server Native Client 11.0: [42S21] Cannot find index                    
(FOC1500)    :  'PK__ibitemdp__86BD01539A7F3333'.                                                     
(FOC1414)    EXECUTE IMMEDIATE ERROR. 

Problem

The user receives the error message above running a procedure that issues the following SQL Passthru command:  ALTER INDEX ... REBUILD      

Solution

The same table name resides in two different schemas; one has an index, and the other does not. To address this issue, change the coding to explicitly include the schema name so the correct table and index is referenced.