Drop and add partitions in SQL Server

  • Hello.

    I am trying to create a database structure in SQL Server that will behave as the one I have created for Oracle DB: There are about 50 tables in the database, when the large data tables (6 tables) are partitioned by date (daily partitions). Each day 2 jobs are running in the database: One job deleted the oldest partition in each table (using alter table drop partition) and the other creates a new partition for the next day (using alter table add partition). This way I have always the same amount of partitions in the tables, and the jobs keep them running and prepare them for future dates.

    But how can I do that in SQL Server? I couldn't find any way to drop a specific partition without touching the rest of the table. The only drop statements I could find dropped the whole partition scheme...

    Help, anyone..?

  • OK, I managed to find an explanation on performing a "sliding window" operation, which is basically switching partitions with tables, and that way moving new data in and old data out.

    Is this the only and best way to drop a partition? It seems like a lot of work for a fairly simple operation!

    Also- can anyone help me with the command to find the high boundary of a specified partition? (So I can tell if the partition is old enough to be dropped)

    Thank you

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply