114

I am using SQL Server 2008 R2. It is working fine. But recently, I have changed my hosting server and I came to know that they have installed SQL Server 2012 on Server.

Now, Issue is that after connecting with Server Database through SQL Server 2008 R2, When I click on any table name or Stored Procedure, I am getting error : Index was outside the bounds of the array. (Microsoft.SqlServer.smo)

So, is there any issue from my side or It is from Server Side ??? and How can I prevent this issue ?

3
  • @paul.abbott, is it compulsary ??? Apr 21, 2014 at 17:41
  • You can go ahead with it, new feature will not be available with it. Mar 11, 2015 at 9:36
  • 1
    In our case, we restored a 2008 R2 Database in SQL 2016 and we had the same problem trying to use the diagram in any way. After running SSMS 2016 13.0.15900.1 as administrator it solved the problem. Go figure! Oct 19, 2016 at 11:39

13 Answers 13

163

Restarting the Management Studio worked for me.

4
  • 14
    It seems the "out of bounds" error is caused by Studio caching the database structure. After you make enough changes to the structure, it will poorly match the cached version and start generating the error. Restarting rebuilds the cache. Oct 17, 2018 at 0:49
  • That was the real issue, i never had time to update my answer. Updating fixes the bug thou Oct 24, 2018 at 16:58
  • 1
    I also had the same error with v18.6 version of SQL Server Management Studio (SSMS). The workaround is to exit the app and start again. Oct 29, 2020 at 1:43
  • 1
    I encountered this problem when I was using SQL Server Management Studio v.18, and closing the app and opening it again fixed the problem for me.
    – J. Zacka
    Dec 10, 2020 at 0:51
54

Upgrade your SqlServer management studio from 2008 to 2012

Or Download the service packs of SqlServer Management Studio and update probably resolve you solution

You can download the SQL Server Management studio 2012 from below link

Microsoft® SQL Server® 2012 Express http://www.microsoft.com/en-us/download/details.aspx?id=29062

3
  • 2
    There's not a fix for this yet. I have had this error in all versions of management studio including the 2018 - it's a shame this bug has been there for so many years now.
    – MeTitus
    Dec 31, 2019 at 8:03
  • 2
    It is 2020 and it is still not fixed. Nov 5, 2020 at 20:17
  • It is 2022 and it is still not fixed. Jul 6, 2022 at 0:56
50

For me this problem still exists with SSMS version 2016 (13.0.16100.1).

A decent workaround is to not use the 'Right click' -> 'Add table...' dialog, but simply drag the table you want to add from the Object Explorer, onto the Diagram surface. While dragging the mouse icon changes into an 'add' symbol and the table is added when you release the mouse.

Beats having to close SSMS every time.

2
  • Diagrams are not available anymore v18.0 preview 4, hopefully they will be back soon!
    – MeanGreen
    Oct 19, 2018 at 12:51
  • 1
    They are available again since 18.1 and up. Your wish has been granted (they were removed since 17.0 but back by popular demand it seems, see mssqltips.com/sqlservertip/6291/…).
    – Abel
    Jan 19, 2021 at 14:20
34

Restarted worked! I found the same error to add new table to my database diagram on sql server 2016, restarted sql server management studio, finally solved.

1
  • Yes. I had this error on SQL Server 2016 Management Studio (v 13.0.16106.4 ) All i had to do was restart the App / UI. Just disconnecting the Server and Reconnecting did not work.
    – joedotnot
    Dec 5, 2018 at 6:41
8

This is an issue if you are using 2008 management studio tools to connect to a SQL 2012 instance.

I experience this a lot if I am working on one server with SQL 2008, and trying to quickly query another server that is running SQL 2012.

I normally keep my personal workstation on the latest version of management studio (2012 in this case), and am able to administer all servers from there.

6

The Reason behind the error message is that SQL couldn't show new features in your old SQL server version.

Please upgrade your client SQL version to same as your server Sql version

3

Solution: Ignore the error

Just to show that the error does not do much in SSMS version 18.9.2, drag the table to be shown in the diagram from the Object Explorer tab and wait for it to finish loading before you start using it.

2
  • 1
    The user was using an old version of Management Studio.
    – mordack550
    Jul 21, 2021 at 15:02
  • This should be higher up, dragging a table/view to the designer, seems to clear this error.
    – J. Minjire
    Jan 17, 2022 at 10:28
2

The suggested causes are now proven to be mostly impossible. I'm running SSMS V17.9.2 against SS 2014 and still have the problem. Memory problems have existed with this tool since at least 2006 when I started using SSMS.

Yes, MS 'wants' to get rid of diagramming but users won't let them. I have a feeling they will never fix any of these issues because they want users to be so fed up with the tool that enough of them quit using it and they can abandon it entirely.

Restarting is still a workaround if you can stand doing so numerous times per day.

1

you must use new version of Management Studio. And also you will got an error 29506. so you should run as Administrator for setup. Look this site. http://shareis.com/post/29506-management-studio-express

1

I had a similar experience with using SMO via C# with the stack trace:

[1896] System.IndexOutOfRangeException: Index was outside the bounds of the array. 
[1896]    at Microsoft.SqlServer.Management.Smo.BitStorage.SetBit(Int32 itemIndex, BitIndex bitIndex, Boolean value) 
[1896]    at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AddObjectPropsFromDataReader(IDataReader reader, Boolean skipIfDirty, Int32 startColIdx, Int32 endColIdx) 
[1896]    at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ImplInitialize(String[] fields, OrderBy[] orderby) 
[1896]    at Microsoft.SqlServer.Management.Smo.SqlSmoObject.Initialize(Boolean allProperties) 
[1896]    at Microsoft.SqlServer.Management.Smo.SqlSmoObject.OnPropertyMissing(String propname, Boolean useDefaultValue) 
[1896]    at Microsoft.SqlServer.Management.Smo.PropertyCollection.RetrieveProperty(Int32 index, Boolean useDefaultOnMissingValue) 
[1896]    at Microsoft.SqlServer.Management.Smo.PropertyCollection.GetValueWithNullReplacement(String propertyName, Boolean throwOnNullValue, Boolean useDefaultOnMissingValue) 
[1896]    at Microsoft.SqlServer.Management.Smo.Information.get_MasterDBPath()

It turned out my versions of the CLR/NCLI/SMO were 10.50.1600.1. Upgrading them to 10.53.6000.34 fixed it - thus allowing the 2008R2 SMO to do many things with 2012 and 2014 servers.

Get them from the feature pack

https://www.microsoft.com/en-gb/download/details.aspx?id=44272

1
0

I found an issue with Diagram and Schema in SQL-Server 2016 that could be useful to the subject. I was editing diagram (related to, and with lot of tables of, the "sales" schema) and added a new table, BUT forgot to declare it schema, so it was with the default "dbo". Then when I returned to, and opened up, the schema "sales" and tried to add an existent table... Bluf! THAT Triggered exactly the same error described in that thread. I even tried the workaround (drag the table) but it didn't work. Suddenly I noticed that the schema was incorrect, I updated it, tried again, and Eureka! the problem was immediately away... Regards.

1
0

It's very old problem with cashed content. MS planning to remove diagrams from SSMS, so they don't care about this. Anyway, solution exists.

Just close Diagrams tab and open it again. Works with SSMS 18.2.

0

You have to use latest version with SSMS

You can check latest builds via this page https://sqlserverbuilds.blogspot.com/

1
  • Welcome here @Osman Taskiran , can you please detail your post and explain the relation between SSMS (Management Studio) and the Question (as it is talking about indexes, etc.) Nov 23, 2020 at 19:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.