locked
Partition Table Switch RRS feed

  • Question

  • Hi,

    I have table 1 which has partition i have other table with same structure  a staging table with same partition. Now when i Switch partition from table 1 to table 2.

    I end up records in table 2 but not in table 1. As all partitions are moved.

    Now how do  i make sure that table 1 has  data even after switch.

    Regards,

    Navin


    Navin.D http://dnavin.wordpress.com


    • Edited by Navind Friday, May 11, 2012 2:24 AM
    Friday, May 11, 2012 1:53 AM

Answers

  • Now how do  i make sure that table 1 has  data even after switch.

    In this case you don't need partition table switch.

    What you have to do is

    SELECT *
    
    INTO stagingTable
    
    FROM dbo.PartitionedTable
    
    WHERE BoundaryColum BETWEEN @leftBoundary and @rightBoundary

    ----------

    @leftBoundary and @rightBoundary - actually boundary limiters of the switched partition

    • Marked as answer by Navind Friday, May 11, 2012 8:08 AM
    Friday, May 11, 2012 8:06 AM