Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7949341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:58:12+00:00 2026-06-04T01:58:12+00:00

Is there a nice script, that generates script to move clustered and non-clustered indexes

  • 0

Is there a nice script, that generates script to move clustered and non-clustered indexes (+ heaps) to other file group?

In perfect world it would look like procedure, where input is table name, new file group name as string (so can give also partitioning schema with columns too) and optional index name (if none given, then moves all indexes or heap). The script would output result (script) in message panel in SSMS, so can review before running..
It would also take in account the enterprise version features (ONLINE) and would make nice scripts for clustered indexes, that can not be dropped and re-created, like here:

CREATE unique clustered INDEX PK_TableName
On dbo.TableName
(
    [ColumnName] ASC
)
WITH (DROP_EXISTING=ON, ONLINE=ON)
ON FileGroup

It would also take in account included columns, filtered indexes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:58:14+00:00Added an answer on June 4, 2026 at 1:58 am

    See

    https://dba.stackexchange.com/questions/16708/moving-large-number-of-tables-to-different-filegroups

    and

    Generate CREATE scripts for a list of indexes

    You just need to massage the output a little bit to include the new filegroup designation and the “drop existing” clause…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a nice way in Ext to move elements in DOM? I want
I got some binary files containing integers. Is there some nice Unix command, that
There's a nice plugin for Frog CMS that lets you just type in yourpicture.120x120.jpg
I have wrote this little script which generates a nice random password. The problem
I have this nifty little script that does a nice job of manipulating some
I am writing a python script that parses a 3D model file from one
Ok, so I have this PHP script that runs in a nice little infinite
Do anybody know if there is a jquery script that can do the same
I have a nice php and ajax script that uploads a photo and displays
I've got a nice power-shell driven post-build script that does some magic mumbo-jumbo for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.