Portal Home > Knowledgebase > cPanel > Database table mover (restore backup)
-- remove bad tableDELETE FROM [ DATABASE-NAME ].[dbo].[ TABLE-NAME ];-- CREATE new table from create script-- allow identity insertsSET IDENTITY_INSERT [ DATABASE-NAME ].[dbo].[ TABLE-NAME ] ON;-- insert into new tableINSERT INTO [ DATABASE-NAME ].[dbo].[ TABLE-NAME ] (--- column list - acquire from script to SELECT)SELECT--- column list as aboveFROM [ DATABASE-NAME2 ].[dbo].[ TABLE-NAME ];-- turn off allow identity insertSET IDENTITY_INSERT [ DATABASE-NAME ].[dbo].[ TABLE-NAME ] OFF;
Add to Favourites Print this Article