how can i merge two datafiles in different filegro

  • I would like to merge two datafiles, but they are in different filegroups.

    Would you know how to merge two datafiles from different filegroups.

    I could use DBCC SHRINKFILE then ALTER DATABASE, but this can only work if the files are in the same filegroup or I can move the tables by creating a clustered index on the table which is on the primary filegroup or simple create a new table, insert the data into it, drop the old table and rename tha new table.

    Do you know how to move a datafile to a new filegroup, eg move the Application datafile to the Primary filegroup or some other way of merging datafiles in different filegroups.

    Thanks in advance

  • Take a look at the EMPTYFILE option for ShrinkFile. I think that is the right way to get the data out without resorting to things like changing your clustered key.

    Andy

  • If you create the clustered key using the new

    filegroup, the data will move. You can then drop the clustered key if you want (not recommended.

    Steve Jones

    steve@dkranch.net

Viewing 3 posts - 1 through 2 (of 2 total)

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