Here are a couple of ways to return partition info for a table in SQL Server.
- You can use the
sys.partitions
system catalog view to return partition info for a table and most kinds of views. - You can use the
sys.dm_db_partition_stats
system dynamic management view to return page and row-count information for every partition in the current database.
If a table or index hasn’t been partitioned, these views will still return partition info (with a partition_number of 1
). This is because all tables and indexes in SQL Server contain at least one partition, whether or not they are explicitly partitioned.