Sunday, July 17, 2011

Rename a Filegroup

Recently I was creating a new table, explicitly referencing the filegroup placement, and the script failed with this:

  Msg 1921, Level 16, State 1, Line 2

  Invalid filegroup 'DatabaseName_Data' specified.

When I checked it out, I found that I had mis-spelled my filegroup name when I created the database.  I thought I would share my correction with you, so you can see the quick way to change the logical name of a filegroup.

   ALTER DATABASE databasename 
   MODIFY FILEGROUP [oldname] 
   NAME = [newname];

No comments:

Post a Comment