Solved

Table Partition switch in and out

Posted on 2013-11-18
2
374 Views
Last Modified: 2014-01-12
Hi Experts,

Could you please help me with a solution for dynamic partitioning in SQL Server including the creation of partition, splitting , Merging , Switching  and archiving to the history table  .

Criteria :
1.maintain 3 months in the current table .
2.older than 3 months , create,split,merge and  switch the partition (partition switch in/switch out)
3. Move to history table older  than 3 months
4. Archive and purge the data older than 5 years

All these steps should be performed dynamically in SQL SERVER.  Please help me with the solution with an example source code. Your help is greatly appreciated.  

Regards,
srk
0
Comment
Question by:n_srikanth4
2 Comments
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 39657724
There is a good article and 13 SQL script files that you could find by if you do a Google search on any of the names listed below:

1_dbo.fn_GetPartitionRangeValueForPartitionFunctionAndNumber.sql
2_dbo.fn_GetPartitionNumberForPartitionFunctionAndValue.sql
0
 

Author Closing Comment

by:n_srikanth4
ID: 39775352
Sounds good article. I will go through this and come up with questions if any.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now