-1

I have implemented partitioning for a particular table, in such a way that user can partition min 1 and max upto 52, to a particular table for a particular year.

Now, after performing partitioning, I want to undo that. So what I am doing is executing following four statements inside while loop, execute them as many times as the count of partition:

ALTER PARTITION FUNCTION TablePF() MERGE RANGE  ('2016-01-01')
ALTER PARTITION SCHEME TablePS NEXT USED [PRIMARY]
ALTER DATABASE TestDB REMOVE FILE TestDBF
ALTER DATABASE TestDB REMOVE FILEGROUP TestDBF

Inside while loop, each time I am putting the correct value of date, file name and filegroup name, but I am not changing the [PRIMARY] filegroup for the partition scheme. I am able to undo the partitioning.

I just want to confirm whether I am doing the correct thing by providing [PRIMARY] filegroup for the partition scheme in above statement#2. Please Suggest.

  • 1
    You say you're able to undo partitionng with the code, so what doubt do you have? – Max Vernon May 25 at 13:28
  • What Max is asking: Have you already performed the task? Or are you asking for advice if the statements are correct? This is not quite obvious from how your "question" is written. Please clarify. – hot2use May 28 at 6:24
  • Yes, I am asking for advice whether using the [PRIMARY] filegroup in this statement is correct: ALTER PARTITION SCHEME TablePS NEXT USED [PRIMARY]. Because I am not changing this statement if i am removing any of the partitions created for the table. – Murali Dhar Darshan May 28 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.