﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Hugh Scott / Article Discussions / Article Discussions by Author  / Automate Sliding Window Partition Maintenance: Part II / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 20:29:37 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Automate Sliding Window Partition Maintenance: Part II</title><link>http://www.sqlservercentral.com/Forums/Topic1037499-234-1.aspx</link><description>I have encouraged our DBA team to get powershell installed (SQL 2005) - no luck yet.  Meanwhile I use a procedure for each partitioning function.  Here is an example where boundaries are YYYYMM.  For monthly loads - we call this in ETL process before insert.  You'll notice no use of filegroups  - it would take a bit more code if we were strategically using filegroups. Ommitted try/catch, error handling to keep is short. create procedure [dbo].[CreateYearMonthPartition] @YearMonth int asdeclare @PartitionId int	-- check if partition for this period already exists 	select @PartitionId = rv.boundary_id + 1 	from sys.partition_functions pf 	join sys.partition_range_values rv on pf.function_id=rv.function_id 	where pf.name='YearMonth_RangeR' 	and rv.value=@YearMonth	if @PartitionId is null 		begin 			-- partition does not exist; create it. 			alter partition scheme [YearMonth_RangeR_scheme] 			next used [PRIMARY]			alter partition function [YearMonth_RangeR]() 			split range (@YearMonth) 		end</description><pubDate>Tue, 21 Dec 2010 09:36:19 GMT</pubDate><dc:creator>Idea Deadbeat</dc:creator></item><item><title>RE: Automate Sliding Window Partition Maintenance: Part II</title><link>http://www.sqlservercentral.com/Forums/Topic1037499-234-1.aspx</link><description>Thanks for continuing the series on this subject.</description><pubDate>Tue, 21 Dec 2010 09:28:21 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>Automate Sliding Window Partition Maintenance: Part II</title><link>http://www.sqlservercentral.com/Forums/Topic1037499-234-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/Partitioning/71656/"&gt;Automate Sliding Window Partition Maintenance: Part II&lt;/A&gt;[/B]</description><pubDate>Mon, 20 Dec 2010 22:34:17 GMT</pubDate><dc:creator>Hugh Scott</dc:creator></item></channel></rss>