0

I created a database in SQL Server 2008. I detached the database and I copied the .mdf over to the server, which is running SQL Server Enterprise Manager (SQL Server 2000).

When I try to attach the MDF I get...

Microsoft SQL-DMO (ODBC SQL State: HY000) Error 602: Could not find row in sysindexes for database ID 13, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

What does this mean? Is this because the db was created in a newer version?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
younes faqri
  • 3
  • 1
  • 3
  • 1
    You **CANNOT** under any circumstances re-attach or restore a database created on SQL Server 2008 to an earlier version of SQL Server. It's just not possible - no trick, no workaround, no tool - just **cannot** be done. – marc_s Nov 13 '12 at 10:09
  • You will need to (1) create that new database in SQL Server 2000, (2) script out all database objects to SQL scripts in your 2008 database, (3) run those scripts in your 2000 version, and (4) also move the data using scripts or a SQL Data Diff tool like [Red-Gate SQL Data Compare](http://www.red-gate.com/products/sql-development/sql-data-compare/) from the SQL Server 2008 to 2000. – marc_s Nov 13 '12 at 10:18

2 Answers2

0

From the documentation on the (I believe depreciated, but used in SQL Server 2000) sp_attach_db stored proc:

A database created by a more recent version of SQL Server cannot be attached in earlier versions.

I think you'll have to script the schema and data of your database.

Pinal Dave has a good tutorial on how to do this here - just remember to make sure you choose the following settings:

Under General:

  • Script for server version: SQL Server 2000

Under Table/View options:

  • Script data: True

Remember to double check the settings for any others you might be interested in, such as foreign keys, triggers etc.

Bridge
  • 29,818
  • 9
  • 60
  • 82
  • thx for you help, i generate the .sql file with the instructions to create my database under sql server 2000 . i just want to know how to execute it in sql server 2000 , i try it by copy all, paste just a part of the file was copied – younes faqri Nov 13 '12 at 11:08
  • @younesfaqri The file generated is probably quite large, so I'd suggest using OSQL : http://msdn.microsoft.com/en-us/library/aa213087%28v=sql.80%29.aspx – Bridge Nov 13 '12 at 11:25
0

This is do-able, but you'd need to convert it to the SQL 2000 format before detaching it and attaching it on the old server. Here are the steps:

In entreprise manager, right click the database

Choose properties

On the left, click Options

Change the "Compatibility Level" to SQL Server 2000 (80)

Then save, and detach before reattaching on the old server.

Brian
  • 3,653
  • 1
  • 22
  • 33