We have a remote client that had to rebuild their server and has been having trouble with their SQL Express database since. I cannot remotely connect to this client unfortunately. I had them run "DBCC CHECKDB" and it showed one of the tables to be corrupted. I had them copy and send me the .mdf and .ldf files so that I could hopefully do something to resolve that.

I can't even attach that database though. I get the below errors when attempting to attach it...

Attach database failed for Server 'GW1\SQLEXPRESS'.

Could not continue scan with NOLOCK due to data movement.
Converting database 'QAData1' from version 655 to the current version 782.
Database 'QAData1' running the upgrade step from version 690 to version 691. (Microsoft SQL Server, Error: 601)

Any idea how I can get around this error or where I could look to possible get a better error message?

Any tips how I can repair a .mdf file if I can't attach it?

  • I can ask for a backup but it'll take me another day or so to get it. I can use the CREATE DATABASE command with a .mdf file too but that gives me the exact same error message I mentioned in my question.
    – Kris
    Commented Feb 16, 2016 at 17:08

1 Answer 1


There have been other cases that have shown that this error can happen when trying to attach a corrupted database.

Instead of detaching the database and sending MDF/LDF files, I suggest asking for a proper backup and attempt to restore it. This is a much safer way to copy a database. Also, detaching a database that is suspect or corrupt is especially dangerous, and absolutely the last thing you ever want to do or advise a client to do. Hopefully the client has backups dating back to before the corruption occurred (and this is why we keep more than just the last backup, and why we test our backups frequently to ensure they can be restored).

To avoid all the upgrade steps, which may be what is causing this to fail, another option would be to set up an instance of SQL Server that matches the version of SQL Server that the client has (SQL Server 2008), because attaching it to a newer version makes real, irreversible changes to the database. This will avoid changing the database and skip the upgrade steps, but is unlikely to allow the database to be attached or restored if there is, in fact, corruption.

As an aside, in general, don't use the SSMS UI to attach a database... write a CREATE DATABASE ... FOR ATTACH; command in a query editor window. The UI leaves a lot to be desired.

  • I switched to using the older SQL 2008 R2 database as was able to successfully import the table, no errors! Thanks.
    – Kris
    Commented Feb 16, 2016 at 21:57
  • @Kris interesting, would love to find out what caused that issue during the upgrade steps then. Any chances you'd share the original MDF? Commented Feb 16, 2016 at 22:25
  • This is for work so I can't share that MDF. I was able to attach it in SQL 2008 but it's still corrupted and I can't export to a clean DB or delete rows from the corrupt tables or do any sort of repairs. I'm pretty hosed at this point. My understanding is that they had some kind of hardware issues on this server and apparently don't have a backup. Not smart.
    – Kris
    Commented Feb 17, 2016 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.