Trying to add MDF to databases

  • I am a newbie trying to add a Wrox sample database to my existing SQL Server databases. In EM I rt click on Databases -> All Tasks -> Attach Database, then browse to the folder and select the mdf file. When I click OK I get the error msg:  Error 602: Could not find row in sysindexes for database ID 9, Object ID 1, Run DBCC CHECKTABLE on sysindexes. If the database is not referenced in EM how can I run DBCC CHECKTABLE on it? Any ideas what my problem is?

    Thanks for any assistance.

    Alan

  • 1. Where did you get the .mdf file from?

    2. Was it copied while the database was still attached?

    You cannot copy a mdf file while the database is in use. It must be detached or the SQL Server services stopped. So, if it wasn't copied while it was 'offline', it won't work.

    -SQLBill

  • Did you get the MDF from a CD? If so you did copy it to the hard drive, right? Check that ithe MDF file does not have the read only attribute set on the file before attempting to attach it.

    Andy

  •  

    Thanks.

    Actually, I downloaded zip files from the Wrox books site and unzipped the files. I did check and they are not read only. Also, I set read/write permissions on the full file path to the mdf.

    Still get the same error.

    Alan

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply