Sangram_2020
Sangram_2020

Reputation: 99

add data files into a primary filegroup in MS SQL Server

When a database is created a file group with a data file is created by default. Is it possible to add more than data file into a primary file group.

Upvotes: 4

Views: 8006

Answers (1)

Christian4145
Christian4145

Reputation: 543

To add an data-file to primary filegroup:

USE [master]
GO
ALTER DATABASE [your_database] 
ADD FILE 
    (NAME = N'logical_name', 
    FILENAME = N'C:\my_data.mdf', -- <--Path to physical file
    SIZE = 1GB, 
    FILEGROWTH = 100MB
) 
TO FILEGROUP [PRIMARY]

Upvotes: 3

Related Questions