SET @SQLString = N'ALTER PARTITION SCHEME [' + @archiveScheme + '] NEXT USED [FileGroup_MDPTSP]'...SET @SQLString = N'ALTER PARTITION FUNCTION ' + @archiveFunction + '() SPLIT RANGE (''' SET @strTEMP = CONVERT(NCHAR(8), DATEADD(day, 7, @dtStart), 112) -- +7 next partition SET @SQLString = @SQLString + @strTEMP + ''')'..SET @SQLString = N'ALTER TABLE ' + @factTable + ' Switch Partition 1 TO ' + @archiveTable + ' Partition 2 ' ...SET @SQLString = N'ALTER PARTITION FUNCTION ' + @factFunction + '() SPLIT RANGE (''' SET @strTEMP = CONVERT(NCHAR(8), DATEADD(day, (7 + 1) , @dtEnd), 112) -- +1 bcoz of this is executre 2nd last day SET @SQLString = @SQLString + @strTEMP + ''')'