How to move the tables without having clustered index from one file group to another file group simply in SQL 2008.?

Hello All,

This might not be the proper for the blog post but it helps me to understand more regarding the transfer of tables within different file groups in MS-SQ L. So, I think it will be more helpful to the others who indeed needs such information related to file groups .

I had posted as below within MSDN

http://social.msdn.microsoft.com/Forums/en/transactsql/thread/d35ab8ff-a6a1-458c-b3e4-b2c9f6a1ff83

I have few issues regarding the transfer of the tables from one file group to another file group  in SQL 2008 and also How can we  backup and restore the particular database based on file group level.

Let’s say I have a tables stored within the different FG. such as

Tables                                                                                                                           File group

Dimension tables                                                                                                              Primary

Fact tables                                                                                                                           FG1

                                                                                                                                            FG2…

zzz_tables                                                                                                                           DEFAULT_FG

dim.table1                                                                                                                           DEFAULT_FG

dim.table2                                                                                                                           DEFAULT_FG

…                                                                                                                                             ….

Here all I want to transfer the dim.table1 ,dim.table2  from  DEFAULT_FG to the Primary File group .So is there simple methods for transfer the dim.table1,2  from one FG to another .I have tried somewhat but I couldn’t get the exact way .So if someone have better idea please share your knowledge that would be really appreciated.

Secondly after moving those dim.table1 ,dim.table2 from DEFAULT_FG to Primary ,All I want to backup and restore the database only containing  the Primary and FG1,FG2… not a DEFAULT_FG.Is it possible or not.?

Currently I have no any clustered index defined within the dim.table1 ,dim.table2 and so on.

Cannot we transfer the tables from DEFAULT_FG to another FG without having clustered index on that tables or without select/insert operation so that I couldn’t have to recreate the tables. I have researched somewhat and found that we couldn’t  move the tables without having the clustered index to another file group simply in MS-SQL so sad :(..!!!

Hope to hear from the one who knows better approach for this kind of task .Your simple help will be much appreciated.

Some helpful links regarding transfer of tables between different FG’s and restore/backup FG’s.

http://www.sqlservercentral.com/articles/Administration/64275/

http://www.sqlservercentral.com/Forums/Topic695367-146-1.aspx#bm695717

http://sqlserverpedia.com/wiki/Restoring_File/Filegroup_Backups

Well after all my full day research on this topic had paid off, I finally got the solution and am so happy to research on these things. It makes us feel really happy after all our research and hard work doesn’t goes as waste.

Finally I got what I am looking for and want to make sure that I am able to transfer the tables from DEFAULT_FG to another FG without tables having clustered index on that tables .

With the help of the link below I finally got my solution where Roberto’s coded store procedure simply works for this.

Really thanks to him for his great post and thanks to everyone for their response in MSDN and their valuable time.

http://gallery.technet.microsoft.com/scriptcenter/c1da9334-2885-468c-a374-775da60f256f

Regards,

Anil Maharjan