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

  • Home
  • SEARCH
  • 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 8851831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:15:09+00:00 2026-06-14T13:15:09+00:00

I need to remove some old files from a production DB, these files are

  • 0

I need to remove some old files from a production DB, these files are parts of partitioned table. So, the steps were following – I deleted data that theoretically were kept there by partition function (all data from 2007).

Then I merge partition function for that year:

ALTER PARTITION FUNCTION pfPeriod() MERGE RANGE (2007);

Then, I wanted to remove file and filegroup:

ALTER DATABASE mydatabase REMOVE FILE tbProperty2007
ALTER DATABASE mydatabase REMOVE FILEGROUP fgProperty2007
  • all by the book.

I’m getting the error:

The file ‘tbProperty2007’ cannot be removed because it is not empty.
The filegroup ‘fgProperty2007’ cannot be removed because it is not empty.

I’ve done this procedure before (for 2005, 2006) and the reason why files wouldn’t remove (for another table) was the index – it was kept in one of the files (I accidentally created index in the partitions of the table). After I recreated index in another filegroup – I could delete file and filegroup without any trouble.

Anyway, this time I recreated indexes in another filegroups, and still – I can’t delete the file and filegroup.

So, can anybody give me an idea how can I see the contents of the *.ndf file, or why the file wouldn’t delete ? please )

P.S. May be it’s a bug of sql server 2012 – I was able to delete files on the sql server 2005, but I can’t do it on 2012.

  • 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-14T13:15:10+00:00Added an answer on June 14, 2026 at 1:15 pm

    Use a query like this:

    select t.name as table_name,
        i.name as index_name,
        ds.name as data_space_name,
        ds.type_desc,
        ps.name as partition_scheme_name
    from sys.tables t
    join sys.indexes i on t.object_id = i.object_id
    join sys.data_spaces ds on i.data_space_id = ds.data_space_id
    left join sys.partition_schemes ps on ps.data_space_id = ds.data_space_id;
    

    This will show you which indexes are hosted on which data space. You can see if you have a non-partitioned index or table in the filegroup fgProperty2007.

    You can also use a query like following to figure out if any partitioning scheme still uses the filegroup:

    select ps.name as partition_scheme_name,
        dds.destination_id as parition_number,
        d.name as filegroup_name
    from sys.partition_schemes ps
    join sys.destination_data_spaces dds
        on ps.data_space_id = dds.partition_scheme_id
    join sys.data_spaces d
        on d.data_space_id = dds.data_space_id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to remove elements in some xml files. How do I correctly ensure
I use the strip_tags() function but I need to remove some tags (and all
I need to remove a big amount of virtual directories, some of them don't
I need to remove the border-top: 1px solid #202020; from .contact on my contact
I need to remove break from a specific div , i know how to
I need to remove element from com.google.gwt.core.client.JsArray . Also I need to empty the
I am required to deploy some files from server A to server B. I
I would need to manage some lists with timer: each element of these lists
I am serving some JSON content from a Google App Engine server. I need
I need to know because I have to explicitly close some remote resources that

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.