How do I create secondary datafile on a databse : 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



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


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


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


Hope this helps,


-- Anonymous, June 14, 2004

Moderation questions? read the FAQ