SQL Server 2005 FileGroups

  • Hi All

    I have 2 FileGroups in a database in SQLServer, and I would like to move a file within FileGroup A to FileGroup B.

    Is this possible without using DBCC ShrinkFile and then creating a new file in the destination Group?

    If so, how? I've searched Google and came up with nothing so far, I would have thought it would be a straightforward Alter Database statement, but I can't find any examples.

  • Files cannot be moved between filegroups. End of story.

    You can use Shrinkfile with the EmptyFile option to empty the file so that it can be dropped, but that's it. If you want to move objects (tables/indexes) to a different filegroup, rebuild the clustered index (for table) or index on the new filegroup.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Wonderful, thanks for your response.

  • GilaMonster (6/21/2011)


    Files cannot be moved between filegroups. End of story.

    You can use Shrinkfile with the EmptyFile option to empty the file so that it can be dropped, but that's it. If you want to move objects (tables/indexes) to a different filegroup, rebuild the clustered index (for table) or index on the new filegroup.

    Thank you Gail, very useful

    M&M

  • I was checking below link related to moving tables from one filegroup to another.

    http://stackoverflow.com/questions/2438019/how-i-can-move-table-to-another-filegroup

    The explanation is fine. However, at the end of the link, there is below statement.

    Yep. And we're both wrong if the PK constraint is clustered.

    I am not sure what this means.Can any one please clarify.

    M&M

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply