|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Regenerating a tableHi
We have a table in the db that we suspect is corrupt. There are only about 40 or so records in there. What is the way to completely recreate this table so it is all clean? We also need the data that is already in the table after rebuild. Thanks Regards A couple of things to try:
SELECT * INTO newtbl FROM tbl CREATE TABLE newtbl(...) INSERT INTO newtbl (...) SELECT ... FROM tbl Then drop old able and rename new table to old table's name. And brefore all script tbl so you have all constraint indexes etc. Before anything do DBCC CHECKDB and also read http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp. -- Show quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://sqlblog.com/blogs/tibor_karaszi "John" <John@nospam.infovis.co.uk> wrote in message news:%23HdTIdojHHA.4624@TK2MSFTNGP04.phx.gbl... > Hi > > We have a table in the db that we suspect is corrupt. There are only about 40 or so records in > there. What is the way to completely recreate this table so it is all clean? We also need the data > that is already in the table after rebuild. > > Thanks > > Regards > Hello,
Please take a full database backup and keep it in a safe location before you attempt to recover/correct the corruption. Thanks Hari Show quote "John" <John@nospam.infovis.co.uk> wrote in message news:%23HdTIdojHHA.4624@TK2MSFTNGP04.phx.gbl... > Hi > > We have a table in the db that we suspect is corrupt. There are only about > 40 or so records in there. What is the way to completely recreate this > table so it is all clean? We also need the data that is already in the > table after rebuild. > > Thanks > > Regards > |
|||||||||||||||||||||||