Reputation: 45096
Below is the command.
rowsRet = -1
How can I know if the rebuild was successful?
If it does not throw an error can I assume it was successful?
This is in a try catch.
sqlCmd.CommandText = "ALTER INDEX [IX_FTSwordDef_word] ON [dbo].[FTSwordDef] " + Environment.NewLine +
"REBUILD WITH (FILLFACTOR = 100, SORT_IN_TEMPDB = ON, STATISTICS_NORECOMPUTE = ON);";
Debug.WriteLine(sqlCmd.CommandText);
int rowsRet = sqlCmd.ExecuteNonQuery();
Upvotes: 2
Views: 260
Reputation: 827
You could try to see the last modified date of the index before and after your command to see if it changed.
To check the last modified date of the index, you can refer to this
SELECT STATS_DATE(OBJECT_ID('TABLENAMEHERE')
, (SELECT index_id FROM sys.indexes
WHERE name = 'INDEXNAMEHERE')
)
Let me know if that helps. (I'm not sure, but I think you should get an error if the REBUILD fails)
Upvotes: 1