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 892049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:59:20+00:00 2026-05-15T13:59:20+00:00

How can I create a File Group on a different drive with MSSQL 2005

  • 0

How can I create a File Group on a different drive with MSSQL 2005 and then move a table into it?

Ex: my database is on H:\Product.mdf and H:\Product.ldf

I want to create a new file group on F:\FileGroup\ and then move my table with a clustered index to this new file group.

  • 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-05-15T13:59:20+00:00Added an answer on May 15, 2026 at 1:59 pm

    This is not a simple task, and depending on the size of your tables may require a chunk of downtime.

    First, you have to define the new file group:

    ALTER DATABASE MyDatabase
     add filegroup NewGroup
    

    Then, create an appropriate file for that file group, for example:

    ALTER DATABASE MyDatabase
     add file
      (
        name = NewFile
       ,filename = 'C:\temp\NewFile.ndf'
       ,size = 100MB
       ,maxsize = unlimited
       ,filegrowth = 100MB
      ) 
     to filegroup NewGroup
    

    To move a table onto the file group, you have to create a clustered index for that table on the file group. If you’ve got a clustered constraint (such as a unique or primary key), you’ll have to drop it first. Here’s one way to move such a table:

    --  Set up sample table
    CREATE TABLE MyTable
     (
       Data varchar(100) not null
       constraint PK_MyTable
        primary key clustered
     )
    
    --  Can't "move" primary key constraint to a new file group
    ALTER TABLE MyTable
     drop constraint PK_MyTable
    
    --  This will move the data in the table to the new file group
    CREATE clustered index Move_MyTable
     on MyTable (Data)
     on NewGroup
    
    --  Still in the new file group, just no index
    DROP INDEX MyTable.Move_MyTable
    
    --  Recreate the primary key, keeping it on the new file group
    ALTER TABLE MyTable
     add constraint PK_MyTable
      primary key clustered (Data)
      on NewGroup
    

    It is just a bit fussy, so be sure to test everything on copies of your databases first!

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

Sidebar

Related Questions

I need to know if I can create a file in a specific folder,
Under MacOSX, I can create a file under root (/) without having admin rights.
How can I create this file in a directory in windows 2003 SP2: .hgignore
How can I create an empty file at the DOS/Windows command-line? I tried: copy
How can I create a .txt file using flex 3? And I want to
Can i create 64-bit setup.exe file using InstallScript project in InstallShield 2009? Documentation is
How can I create a empty .mdb file? I'm using ADO.NET and C#. Thanks!
How can I create a simple PHP file, which will retrieve the HTML and
How can I create custom variable in helper.php file set it right here and
How can i create .KMZ (google earth file format) programmatically? .KMZ contains a .KML

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.