question

Naren avatar image
Naren asked

How to move the indexes to new file group?

Indexs are maintained in one file group mdf file... Now I want to move those indexes into new file group mdf file.... How to move the indexes to new file group?
sql-server-2005dba
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Håkan Winther avatar image
Håkan Winther answered
You can use the syntax below: CREATE NONCLUSTERED INDEX ixname ON tablename ( col1 )WITH(DROP_EXISTING=ON) ON secondaryfilegroupname (you have to replace ixname, tablename, col1 and secondaryfilegroupname with your own values, and decide if it should be an clustered or non clustered)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Usman Butt avatar image
Usman Butt answered
If scripting out all the indexes seems a bit difficult for you, you can follow this hyperlink http://blogs.msdn.com/b/ramoji/archive/2008/09/26/how-to-move-existing-indexes-from-one-filegroup-to-another.aspx Moreover, as Mr. Håkan Winther have showed in the template, you should try to move only the non-clustered indexes. There is a very seldom need to move the clustered index (moving the whole table data), but it all depends upon the environment.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.