You are here: Re: Time to shrink a database « MsSQL Server « IT news, forums, messages
Re: Time to shrink a database

Posted by Erland Sommarskog on 10/02/60 11:45

pb648174 (google@webpaul.net) writes:
> Ok, does running the below once per week seem reasonable for a SQL 2005
> DB?

Some small modifications:

> DECLARE TableCursor CURSOR FOR
> SELECT top 1 table_name FROM information_schema.tables

1) The TOP 1 should probably not be there.

2) Change "table_name" to quotename(table_name), so you can defrag
Northwind and its Order Details too. :-)

3) And change to correct case, in case you one day want to run it on
case-sensitive database. It's INFORMATION_SCHEMA etc.

And I will have to admit that I have not really digested the new
ALTER INDEX syntax in SQL 2005, but I guess that part looks find.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация