I tried the script below, but I get the error message below.
ALTER DATABASE TestDB
ADD FILEGROUP FG4;
ALTER DATABASE TestDB
ADD FILE
(
NAME = FG4,
FILENAME = 'C:\TestDB\dbfile4.ndf',
SIZE = 2000,
FILEGROWTH = 10%
)
TO FILEGROUP FG4
Msg 5035, Level 16, State 1, Line 1
Filegroup 'FG4' already exists in this database. Specify a different name or remove the conflicting filegroup if it is empty.
Msg 1834, Level 16, State 1, Line 4
The file 'C:\TestDB\dbfile4.ndf' cannot be overwritten. It is being used by database 'TestDB'.