Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - SQL Server 2005/Yukon
 Attaching SQL Server Express Databases

Author  Topic 

ktola
Starting Member

6 Posts

Posted - 2006-03-28 : 13:53:58
I have received numerous Sql Server Express MDF files either from sources such as Microsoft Quick Start forums or as part of a given programming book and they all focus on attaching these files to SQL Server Express 2005.
Invariably I cannot attach these databases and, unless I obtain the setup scripts for these databases, I am stuck. In every case, I obtain the same error:

Could not find row in sysindexes for database ID 11, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'RandomExpressDatabase'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

I have tried everything I can think of to remedy this problem - including creating the database, stopping SQL Server and overwriting the files with the Express files - any nothing works. Does anybody have any ideas?!?

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2006-03-28 : 13:58:56
just to confirm you are also using .ldf file (log files) along with you .mdf files?
Go to Top of Page

ktola
Starting Member

6 Posts

Posted - 2006-03-28 : 14:10:13
Yes I am and that is where I believe that is where the errors reside (but I know nothing at this point).
For a good example, you can go to http://www.murach.com/downloads/ugcs.htm and click on All Book Files to download their ZIP EXE that will extract all of their code samples/databases to your C drive by default.
If you then go into the Database directory within that downloaded folder you will find their Halloween.MDF and LDF files...and you will see the problem I am experiencing if you attempt to attach them to a full SQL Server 2005 instance...
Go to Top of Page

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2006-03-28 : 15:09:36
well it works for me. I am using SQL server 2005 develoepr editon but it should also work in express? you should post this in the express forum
Go to Top of Page

TimS
Posting Yak Master

198 Posts

Posted - 2006-03-28 : 15:16:05
Edit db_attach.bat to use your server name

-- server is default instance
sqlcmd -S localhost -E /i db_attach.sql

-- server is named instance of SQL9DEV
sqlcmd -S localhost\SQL9DEV -E /i db_attach.sql

I would add a pause command at the end to see possible errors.

Tim S
Go to Top of Page

TimS
Posting Yak Master

198 Posts

Posted - 2006-03-28 : 15:28:53
Note: in the web.config files remember to change "Data Source=localhost\SqlExpress" to point to your server which may be
"Data Source=localhost"

Tim S
Go to Top of Page

ktola
Starting Member

6 Posts

Posted - 2006-03-28 : 15:30:49
I am using the full version of SQL Server 2005 - not Express. When I modified the BAT file, I still obtained the following error:


C:\Murach\ASP2C#Upgrade\Database>sqlcmd -S localhost -E /i db_attach.sql
Msg 602, Level 21, State 50, Server SandboxServer, Line 1
Could not find row in sysindexes for database ID 11, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Msg 1813, Level 16, State 2, Server SandboxServer, Line 1
Could not open new database 'Halloween'. CREATE DATABASE is aborted.

Could there be something corrupt with my database instance?
Go to Top of Page

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2006-03-28 : 15:36:15
Could there be something corrupt with my database instance? possible..do you have have adventureworks installed? if yes delete that database and try reinstalling it.
Go to Top of Page

ktola
Starting Member

6 Posts

Posted - 2006-03-28 : 15:38:42
I do not have this database, however I am using the Community Technology Preview which gives me all of the bells and supposed whistles.
Go to Top of Page

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2006-03-28 : 16:30:07
You said you are using full version of SQL Server 2005 - not Express and you are using CTP and not RTM version
Go to Top of Page

ktola
Starting Member

6 Posts

Posted - 2006-03-28 : 16:35:12
That is correct

Go to Top of Page

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2006-03-28 : 16:58:20
oh my..
why in the world you are using CTP --SQL Server 2005 RTM was released back in November 2005
completely uninstall CTP..you are driving everyone's nuts here..
Go to Top of Page

ktola
Starting Member

6 Posts

Posted - 2006-03-28 : 17:04:12
Sorry for driving you guys nuts! So using SQL Server Express is a better option?
Go to Top of Page

cookiekhanh
Starting Member

2 Posts

Posted - 2006-04-17 : 16:20:14
I AM using the full version of sql server 2005 management studio and i am also getting this error.

I was using the databases from an ASP.NET commerce starter kit in sql express. I want to update to sql server 2005, so i detached the dbs.
i deleted the sql express management studio ctp and installed sql server 2005 from the free 6 month trial available online.

I then attempted to attache the sql express files to sql server 2005.


any help here?

thank you,
K
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-04-18 : 02:00:27
i believe the files are corrupted, just download new ones, no use in giving yourself a major headache...

or ask Mike at the sql express forum... he's the "express" guy



--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -