Inside Microsoft SQL Server 7.0 (Mps)

You can use the ALTER DATABASE statement to change a database's definition in one of the following ways:

The ALTER DATABASE statement can make only one of the changes just described each time it is executed. Note that it's impossible to move a file from one filegroup to another.

ALTER DATABASE Examples

The following examples demonstrate what you can do with ALTER DATABASE. This first example increases the size of a database file:

USE master GO ALTER DATABASE Test1 MODIFY FILE (NAME = 'test1dat3', SIZE = 20MB)

This next example creates a new filegroup in a database, adds two 5-MB files to the filegroup, and makes the new filegroup the default filegroup. Three ALTER DATABASE statements are needed:

ALTER DATABASE Test1 ADD FILEGROUP Test1FG1 GO ALTER DATABASE Test1 ADD FILE ( NAME = 'test1dat3', FILENAME = 'c:\mssql7\data\t1dat3.ndf', SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB), ( NAME = 'test1dat4', FILENAME = 'c:\mssql7\data\t1dat4.ndf', SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB) TO FILEGROUP Test1FG1 GO ALTER DATABASE Test1 MODIFY FILEGROUP Test1FG1 DEFAULT GO

Категории