Wednesday, March 21, 2012

Move Table to other filegroup?

Hi every body,
Is there anyone know the way to move a table with data to other file group?Use 'Alter Database' statement. You may have to do the 'Alter' to add new filegroups, then do the moving tables and cleaning up old filegroups. To remove it, of course, it's another 'Alter'. Remember to remove a filegroup the file has to be empty. Good luck!|||I believe that you will have to:

1. Add the new file group
2. Create an identical table on the new file group with a different name
3. Copy the data from the existing table to the new table
4. Drop the old table
5. Rename the new table

If you want to retain indexes, constraints, foreign keys and defaults with the same names, then you will have to re-create these after dropping the current ones.

Regards,

hmscott|||Actually, you can virtually move the data from the table to a different filegroup by creating a clustered index and placing it wherever you want.

No comments:

Post a Comment