Can you add a "SwitchPartition" function?

Mar 21, 2013 at 12:23 AM
Edited Mar 21, 2013 at 12:23 AM
I think it would be useful to add a "SwitchPartition" function to avoid having to find the partition number and then call ALTER TABLE ... SWITCH following a staging table load.

For my SSIS package I had to:
  • define a variable for Partition Number
  • populate with the results of a variable-driven query e.g. SELECT CAST ( $partition.InvestmentStructureExposures AS NVARCHAR(250) )
  • use the Partition Number to generate another variable-driven SQL for the ALTER TABLE ... SWITCH
It strikes me that all the required sub-functions, parameters etc are already there to allow adding this function into the code. This would mean one last call to your module could take care of that and save a bit of package complexity.

Thanks
Mike