Mssql server has a list of tools you can use for this. When you create the
database (or later modify it through Enterprice Manager) you can specify
'Auto Shrink'. This will make sure the file sise is optimized when you
delete data.

This cal also be done with this call:

sp_dboption('database', 'autoshrink', 'true')

You can also do this on request. This section is taken from the MSSQL

    (    database_name [, target_percent]

Is the name of the database to be shrunk. Database names must conform to
the rules for identifiers. For more information, see Using Identifiers. 
Is the desired percentage of free space left in the database file after
the database has been shrunk. 
Causes the freed file space to be retained in the database files. If not
specified, the freed file space is released to the operating system. 
Causes any unused space in the data files to be released to the operating
system and shrinks the file to the last allocated extent, reducing the
file size without moving any data. No attempt is made to relocate rows to
unallocated pages. target_percent is ignored when TRUNCATEONLY is used. 

- Frank

> Please forgive me for being somewhat off topic.
> This information is going towards a db class written in php.
> Does MSSQL have an SQL command counterpart to mysql's Optimize or
> postgresql's Vacuum??
> Thanks for any insight you may provide...
> -- 
> PHP Database Mailing List (
> To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to