2

I'm hitting a wall here and it is driving me nuts.

I had huge server crash with corrupt backups spanning a couple months. What I had to do was do a restore of a really old backup and now I am trying to import the good tables back in.

System is CRM 2011 with SQL Server 2008.

The old database only has a few corrupt tables so I should easily be able to import the updated new tables into the old database right? At least so I thought...

Import/Export is useless... I found a script to easily drop constraints however it errors out due to primary key contraints....

Then I can't drop a table and import the updated one becuase of Foreign Key Constraints.

I've done this process many times in MYSQL. It's completely absurd this doesn't even seem possible in something you pay thousands for.

Any help would be greatly appreciated.

Is there some way to simply force drop a table with constraints? Some of these tables it would be impossible to remove the contraints since they referenced by a massive amount of tables. I just need to substitute one table for another.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    You'll probably get a better response to this on the DBA site (I've voted to move it) but restoring individual tables is potentially risky because of data integrity and that's exactly why the constraints are protecting you. It's easy to disable them and there are various ways of copying entire tables from one place to another, but especially with a third-party application there's always a risk that you mess up the data. Hopefully you've already reviewed your backup process to make sure this doesn't happen again; restoring a backup is by far the easiest way to recover from data corruption. – Pondlife Jul 06 '12 at 16:39

1 Answers1

0

I provided a similar solution to dropping a table with constraints. You would still have to remove the foreign constraints, but this scripts should help do that.

SQL Server: drop table cascade equivalent?

Community
  • 1
  • 1
Vinnie
  • 3,889
  • 1
  • 26
  • 29
  • Is there any easy way to copy relevant data into the tables manually without needing to script everything out? Simply replacing the old data from parts of the corrupt database would be the simplest solution. For example, I need to add a single user from the new database. Do I have to drop the entire table? – feratechinc Jul 09 '12 at 14:34