Renaming Filegroup in SQL Server | SansSQL

Friday, June 7, 2013

Renaming Filegroup in SQL Server

Renaming of a filegroup is SQL server can be done using T-SQL scripts as demonstrated below.
SELECT name AS BeforeRename FROM sys.filegroups

ALTER DATABASE SansSQL 
MODIFY FILEGROUP Secondary NAME=SansSQLFG

SELECT name AS AfterRename FROM sys.filegroups


Important thing to note here is, we will not be able to rename the Primary filegroup and when we try to rename the primary filegroup, we get an error which says
Msg 5012, Level 16, State 1, Line 1
The name of the primary filegroup cannot be changed.

No comments:

Post a Comment