During my attempt to shrink my database so that it would fit on my laptop (it was 20 gigs), I figured out that I needed to reindex all my tables. Usually the format of your data and log files will follow this pattern – just replace the {DATABASE_NAME} with the name of your database.
DBCC SHRINKFILE ({DATABASE_NAME}_data,5)
DBCC SHRINKFILE ({DATABASE_NAME}_log
, 1);
BACKUP LOG {DATABASE_NAME}
WITH TRUNCATE_ONLY;
DBCC SHRINKFILE ({DATABASE_NAME}
_log, 1);
4 responses to “Sql Server Reindex Tables”
You’ve got a bug in the DBCC line — you used @tablename when you should’ve only used @table. Otherwise works great. Thanks.
Thanks! I fixed it!
Thanks! I needed this
Thanks this has helped me.