Add a script component to the error handler within the package and pass the error message as a readonly variable.
Practical Business Intelligence Solutions using the
Microsoft BI Suite of Tools provided along with Microsoft SQL Server
Add a script component to the error handler within the package and pass the error message as a readonly variable.
-----------------------------------------------------------------
-- where MyTable and MyIndex are replaced with appropriate values
-- and 'IndexID' is the non-replaced string value actually used
If IndexProperty(Object_Id('MyTable'), 'MyIndex', 'IndexID') Is Null
CREATE INDEX index_name ON table_name (column1, column2, ...)
-- for example:
If IndexProperty(Object_Id('dbo.TEST'), 'IX_TEST_State', 'IndexID') Is not Null
BEGINCREATE INDEX [<IndexName>] ON [<DatabaseName>].[<Schema>].[<TableName>]([column1]) ,,,END