We are migrating an application's database between servers and we have used the Attach method to attach the database files to the new location.

After re-pointing the application to the new database all operations can be performed successfully except for one, which requires a group of tables modifications. These tables are linked with KFs and have an Index.

enter image description here

enter image description here

It's strange because we don't face these issues with the old database. We have checked the Triggers, FK relations, and Indexes, and it all looks similar between both DBs.

Is there a hidden relationship that requires fixing?

P.S.: I am a programmer, not DBA and these are the steps I have performed:

  1. Copy .mdf then paste to the new server
  2. Attach the .mdf to the new
  3. server Repoint the application to the new IP Test the operations,
  4. it's all working and can insert/update the new DB A group of
  5. operations related to logically related tables are not working.
  • The attach gave you a binary copy of the database, and the problem doesn't seem to be permission related (orphaned user). I.e, we don't have anything to go on here. You would have to dig into what the app is doing (the sql statements) and why you hey this error. Apr 19, 2023 at 14:29

1 Answer 1


Getting errors on a copy of a database, but not the source has me wondering if there was some sort of corruption introduced. When copying or moving database files themselves (mdf's, ldf, and any ndf's), make sure that the database is offline. If you don't want to take the database offline, use your regular SQL-aware backup/restore process.

Running a CHECKDB on the source and restored database could identify any issues too.

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.