Additional SQL2005 database appears "Transact-SQL ... An exception "

Source: Internet
Author: User
Tags microsoft sql server create database

Additional Database error prompt:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

The row for index ID 1 of Object ID 1 in database ID 7 could not be found in sysindexes. Run DBCC checktable on sysindexes.

Could not find row in sysindexes for database ID 7, Object ID 1, index ID 1. Run DBCC checktable on sysindexes.

Failed to open new database ' Xiaoche '. The CREATE DATABASE will terminate. (Microsoft SQL Server, error: 602)

Workaround:

One

. SELECT @ @version See the current version of the database instance, SQL2000 in the attached SQL2005 database.

Two

SQL2000 additional SQL2005 Data specific method

If you use SQL2000 to attach a SQL2005 database, an error 602 appears when attaching, prompting "run DBCC CHECKTABLE against sysindexes" since the database is attached to 2005, the database file has been automatically upgraded to 2005. So the 2000 is no longer attached (no upward compatible)

Direct restore or attach is not possible, with script + Guide data certainly no problem.

2005 Steps to 2000

1. Generate a For 2000 version of the database script

Manger Studio, 2005

--Open "Object Explorer" (no words pressed F8), connect to your instance

--right key to go to 2000 of the library

-Mission

--Generating scripts

--In the "Select Database" of the Script wizard, make sure that you select the library that you want to go to 2000

--"Scripting all objects in the selected database" is checked

--In the next "Choose script Options", locate the "Script for server version" entry, select SQL Server 2000

--other options set as needed

--Finally, save the script to a. SQL script file

2. Create the target database in 2000

In Query Analyzer (or 2005 of Manger Studio opens the script file), connect to SQL Server 2000 and execute the script generated above. To create a new database

3. Lead the data from 2005 to 2000

Manger Studio, 2005

--Open "Object Explorer" (no words pressed F8), connect to your instance

--right key to go to 2000 of the library

-Mission

--Export data

--In the "Select data source" step of the SQL Server Import and Export Wizard, determine which database to export is selected

--In the Select target step, connect to 2000 and select the library you created in step 2

--In Select source table and Source view, select all tables

--finally completed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.