Home > Archive > MS SQL Server > October 2006 > Finding the file that a partition is stored in









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Finding the file that a partition is stored in
Joe

2006-10-31, 7:12 pm

I've looked through the various sys views regarding partitions but I can't
seem to find a way of determining what physical file or filegroup an
existing partition is stored on. Even the original create script for a
partition can't be relied on as partition ranges can be merged or split.

Thanks,

Joe Lax


Linchi Shea

2006-10-31, 7:12 pm

The catalog view to query is sys. destination_data_spa
ces. A query similar to
the following should do:

select ds.name
from sys. destination_data_spa
ces dds join sys.data_spaces ds
on dds.data_space_id = ds.data_space_id
join sys.indexes i
on dds.partition_scheme_id = i.data_space_id
where dds.destination_id = $partition. PartitionFunction('y
our value')
and i.object_id = object_id('table name')
and i.index_id in (0,1)

Linchi

"Joe" wrote:

> I've looked through the various sys views regarding partitions but I can't
> seem to find a way of determining what physical file or filegroup an
> existing partition is stored on. Even the original create script for a
> partition can't be relied on as partition ranges can be merged or split.
>
> Thanks,
>
> Joe Lax
>
>
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com