Monday, 18 January 2010

Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

So, having decided to use the built-in Standard Reports on SQL 2005 to check how one of my databases had been auto-growing and shrinking, as the free space looked a little suspect (as did the fact that the database had shrunk between Friday morning and Monday morning for no apparent reason other than a reindex...), I got the error in the title:

Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

Fair enough. According to SQLSkills, this is a compatibility issue. I was using SQL 2008 Management Studio, and was checking a SQL 2005 database. Usually, this doesn't cause a problem, as the reporting tools were first introduced in SQL 2005.

Unfortunately, this database turned out to have a compatibility level of 80 - SQL 2000. Running the report in SSMS 2005 gave the following error:

Unabel to display the report because the database has a compatibility level of 80. To view this report, you need to use the Database Properties dialog to change the compatibility level to SQL 2005 (90).

This has the advantage of being rather more explicit, but none the less irritating...

5 comments:

  1. Did you ever find a solution to this? I have a SQL Express 2008 database reporting this when I try to run the same usage reports.

    ReplyDelete
  2. The solution is to change the database compatibility level under the database properties. It needs to be 90 or greater, ie SQL2005 or greater.

    ReplyDelete
  3. Perfect. Just what I needed to discover one of my DB tables over 1.4GB that should be 20k!!!

    ReplyDelete
  4. Thank you.It worked

    ReplyDelete