This post is here to help if you’ve encountered the following error while performing a task in SQL Server Management Studio (SSMS):
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index (mscorlib)
![Index Out of Range SQL Server Management Studio](https://peter-whyte.com/wp-content/uploads/2019/04/ssms_index_was_out_of_range.png)
In my experience, I’ve seen this come up several times when trying to change the order of steps in a SQL Agent Job in SSMS.
Resolving “Index was out of range” Issue
To resolve this issue, update to the latest version of SSMS.
Feel free to follow my link for installing the latest version of SSMS which includes a link to the Microsoft download and some useful SSMS tips from a DBA. Otherwise, the quick official link is here: Microsoft Docs: SSMS Download
Full Error Message & Follow-Up
This error might even happen for you even if using the latest version of SSMS. I’m not sure what the root cause is, but the first best troubleshooting step is to update SSMS as explained.
Here’s the full error I got:
I tried to change the SQL Agent job step here from step 3 to 1:
![SQL Agent Job Steps](https://peter-whyte.com/wp-content/uploads/2019/04/sql_agent_job_steps.png)
![SQL Agent Job Step Order Change](https://peter-whyte.com/wp-content/uploads/2019/04/sql_agent_job_step_order_change.png)
I got this error message when I hit the button above:
![Index Out of Range error SSMS](https://peter-whyte.com/wp-content/uploads/2019/04/ssms_index_was_out_of_range.png)
![Index out of range Full Error](https://peter-whyte.com/wp-content/uploads/2019/04/ssms_index_was_out_of_range_full_error.png)
Searching for this error online often led me to a lot of unrelated information about .NET development. If updating SSMS resolved for you, or if you’ve done that and still having the issue, please feel free to add a comment below!
Leave a Reply