SCCM SQL Query: Pulling Hierarchy Information from the Database

Quick SQL Query for Configuration Manager Site Hierarchy Info If you need a fast overview of your Configuration Manager hierarchy — site codes, site names, parent/child relationships, server names, and versions — without opening the console, a simple query against the ConfigMgr SQL database gives you the whole picture in one result set: SELECT * […]

SQL Query For SCCM Hierarchy Information

Quick SQL Query for Configuration Manager Site Hierarchy Info

If you need a fast overview of your Configuration Manager hierarchy — site codes, site names, parent/child relationships, server names, and versions — without opening the console, a simple query against the ConfigMgr SQL database gives you the whole picture in one result set:
SELECT * FROM v_Site
Run this against your Configuration Manager site database (not the master database) in SQL Server Management Studio, or via a report in SSRS if you want it available as a scheduled or on-demand report for your team. The v_Site view returns every site in the hierarchy the database knows about, including the site server name, version, build number, and parent site code — handy for a quick hierarchy audit or for confirming every site is on the version you expect after a servicing update rollout. This is one of a large number of useful out-of-the-box SQL views ConfigMgr maintains, most starting with the v_ prefix — worth exploring further if you’re building your own SSRS reports, since Microsoft documents the full set of supported views for exactly this kind of custom reporting.

Still Current on Configuration Manager 2603 (Updated for 2026)

The v_Site view hasn’t changed on the current release (Configuration Manager 2603) — it’s one of the long-standing core views and still returns the same site hierarchy columns (site code, site name, parent site code, server name, version, and build number). If you want to go a level deeper than a raw hierarchy dump, pairing it with v_SummarizerSiteStatus or checking the Type column (which flags primary vs. CAS vs. secondary sites) gives you a fuller picture without needing a second query.

Resources


Discover more from TechyGeeksHome

Subscribe to get the latest posts sent to your email.

Andrew Armstrong

Andrew Armstrong is a UK-based IT professional with 26+ years of hands-on experience in Windows, Windows Server, SCCM/ConfigMgr, Active Directory, PowerShell, and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published over 1,500 practical guides covering real-world IT problems and solutions. When not solving IT problems,

Andrew develops free Windows utilities including Ultimate Settings Panel, which has been downloaded over 850,000 times.