How do I create secondary datafile on a databse

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

I want to create a secondary datafile to a database.what steps I need to follow

-- Anonymous, June 09, 2004

Answers

Shivakumar,

You will need to use the Transact-SQL "ALTER DATABASE" statement. The SQL Server Books Online provides an example in the article titled, "ALTER DATABASE". Here is the example provided there.

A. Add a file to a database

This example creates a database and alters it to add a new 5-MB data file.

USE master

GO

CREATE DATABASE Test1 ON ( NAME = Test1dat1, FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\t1dat1.ndf', SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB )

GO

ALTER DATABASE Test1 ADD FILE ( NAME = Test1dat2, FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\t1dat2.ndf', SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB )

GO

Hope this helps,

Eric

-- Anonymous, June 14, 2004


Moderation questions? read the FAQ