• Festeron (8/16/2010)


    It does care. Because if there is no data in one partition, then the result varies.

    That was my understanding, but the supplied answer seems to say that the function will return a partition number even if that partition has no data. To my eye, $Partition.PF(Key) needs Key values to be supplied if it is to return partition numbers for those Keys.

    I have to agree that this part of the explanation is confusing.

    $Partition.PF(value) will return the partition where that vallue would be stored, even if that partition (or even the whole table) is currently empty.

    But in the query used in this question, the value was taken from actual table data. And it will not return data for rows that don't exist. So this particular query will only return the partitions with at least one row of data in it, but that is not a limitation of the $Partition.PF() function.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/