Search code examples
sql-server-2005filegroup

Tables in 2 filegroups sql server


My predecessor for some reason split the data between two filegroups in our SQL Server 2005 database.

I'm thinking about just putting everything in one.

Any speculation on why someone would split things between filegroups with two files on the same server?

How do I put all of the objects in a single group?


Solution

  • You'd split for several reasons:

    • partitioning
    • index/data separation
    • more disks (especially with SAN)
    • read only filegroup for static data
    • filegroups for BLOB/FILESTREAM
    • ...

    Anyway, to move tables you'd ALTER the clustered index which moves the data.

    When you script tables/indexes, you see CREATE INDEX (--- ) ON [PRIMARY] where PRIMARY is a filegroup, also in the CREATE TABLE for clustered indexes

    Other SO answers from me on filegroups: