Home All Groups Group Topic Archive Search About

Regenerating a table

Author
4 May 2007 8:03 PM
John
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

Author
4 May 2007 8:16 PM
Tibor Karaszi
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 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
>
Author
6 May 2007 9:39 AM
Hari Prasad
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
>

AddThis Social Bookmark Button