Is there a TSQL way to move all indexes for a table to a filegroup without doing it one by one? It’s looking like a dynamic SQL type of scenario.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You can use Object Explorer Details (Management Studio), browse to the table then to it’s indexes folder. Highlight all then script -> Create to -> new query window
It will generate all of your create scripts. Change the DROP_EXISTING = OFF to DROP_EXISTING = ON and the change [PRIMARY] to what ever your new file group name is.
This requires a few manual steps but gives good control especially if you only want select indexes (not all of them).