Solved

Table Partition switch in and out

Posted on 2013-11-18
2
379 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

810 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