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.
1 Answer
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]
2 Comments
Sangram_2020
I need to verify this
Christian4145
You can add files to the filegroup "PRIMARY" the way you can add files to any other filegroup. You can delete these additional files again (when they are empty) like in any other filegroup. But you cannot delete the filegroup "PRIMARY". It is also not possible to rename it.