Upgrading from vCenter Server 4.1 to 5.0 fails and an exception is thrown while executing SQL script. This issue occurs if an index named INDX_TIME_ID in the VPX_HIST_STAT1 table was not deleted in a previous upgrade and continues to exist. The script to upgrade the table fails because of the index's constraint on the TIME_ID column.
To remove the lingering index on the table:
Launch SQL Server Management Studio and Connect to the SQL instance of the vCenter Server database.
Take a backup the vCenter Server database.
To back up the vCenter Server database, right-click the database and click Tasks > Back Up.
Expand the Databases folder.
Click the vCenter Server database name.
Click the New Query button on the toolbar. A blank query window appears.
Enter this SQL statement in the blank query window:
DROP INDEX VPX_HIST_STAT1.INDX_TIME_ID
Execute the statement by pressing the F5 key or by clicking the ! Execute button on the toolbar.
For more information read the following article from VMware KB.