Determine (Target) Partition Number

  • Is there a way to find the numer of the partition that was last created?

    I want to use the swap technique with partionig like this:

    ALTER PARTITION SCHEME PSMonthly NEXT USED [PRIMARY]

    GO

    ALTER PARTITION FUNCTION PFMonthly () SPLIT RANGE (20040601)

    GO

    [snip]

    ALTER TABLE PseudoPartition_200405 SWITCH TO PartitionTable PARTITION [???]

    GO

    The problem is that I have to find [???] dynamicly.

    Thanks

  • This was removed by the editor as SPAM

  • You can use $PARTITION function, take the new range boundary value as the parameter if boundary value belongs to RIGHT, or 1 plus the new boundary value as the parameter

    SELECT $PARTITION.PFMonthly(20040601) 

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply