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.
| Author |
Topic |
|
kirknew2SQL
Posting Yak Master
194 Posts |
Posted - 2008-01-14 : 16:04:38
|
| I have a large table that I need to play with a devise a solution. I want to make a back up copy of it so that if I crash it I can easily restore. What is the best way to backup/restore a single table? |
|
|
mauler05
Starting Member
17 Posts |
Posted - 2008-01-14 : 17:08:57
|
| The easiest way is to execute following Select * into TempTable from YourOriginaltable and then if something goes wrong to YourOriginaltable then you can copy back everything from TempTable to YourOriginaltable by following : ALTER TABLE YourOriginaltable NOCHECK CONSTRAINT ALL--Temporarily disable constraint on YourOriginaltable delete from YourOriginaltable --make sure you are not duplicatingInsert into YourOriginaltable Select * from TempTable --YourOriginaltable will be back in the same stateALTER TABLE YourOriginaltable CHECK CONSTRAINT ALL--Place constraint back on YourOriginaltable |
 |
|
|
kirknew2SQL
Posting Yak Master
194 Posts |
Posted - 2008-01-14 : 17:30:26
|
| Good plan. :) Thank you |
 |
|
|
|
|
|