Cautare tabele partitionate pe o baza MSSQL

Configurare noua (How To)

Situatie

Procedura de mai jos listeaza pe o baza de date de pe un server MSSQL, toate tabelele ce sunt partitionate.

Solutie

alter procedure FindPartitionedTable_prc

as

select
distinct
pp.[object_id],
TbName = OBJECT_NAME(pp.[object_id]),
index_name = i.[name],
index_type_desc = i.type_desc,
partition_scheme = ps.[name],
data_space_id = ps.data_space_id,
function_name = pf.[name],
function_id = ps.function_id

from sys.partitions pp
join sys.indexes i on pp.[object_id] = i.[object_id] and pp.index_id = i.index_id
join sys.data_spaces ds on i.data_space_id = ds.data_space_id
join sys.partition_schemes ps on ds.data_space_id = ps.data_space_id
join sys.partition_functions pf on ps.function_id = pf.function_id

order by TbName, index_name

Tip solutie

Permanent
Etichetare:

Voteaza

(4 din 7 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?