EngineEdition Branches Inside System Procedures DBAs Already Call

A script calls sp_helpindex because it has done that since SQL Server 2008. Another one calls sp_updatestats after a restore. DBAs do not usually use these procedures as feature probes. Their definitions now contain edition branches for engine surfaces that are not boxed SQL Server.

A woman DBA with a clipboard stands at a railway switch lever, looking at one track that branches toward several small stations.

This post is part of the Undocumented Changes in SQL Server 2022 and 2025 series. The contents page lists every part in order.

This post builds on the SQL Server 2025 changed-procedures post, the SQL Server 2022 changed-procedures post, and the FIDO procedures post. For the wider SQL Server 2025 inventory, see the first post on SQL Server 2025.

SERVERPROPERTY('EngineEdition') returns an integer that identifies the database engine edition. The current Learn page lists these values for EngineEdition: “1 = Personal or Desktop Engine (Not available in SQL Server 2005 (9.x) and later versions.) 2 = Standard (For Standard, Standard Developer, Web, and Business Intelligence.) 3 = Enterprise (For Enterprise, Enterprise Developer, Developer, and Evaluation editions.) 4 = Express (For Express, Express with Tools, and Express with Advanced Services) 5 = SQL Database 6 = Azure Synapse Analytics 8 = Azure SQL Managed Instance 9 = Azure SQL Edge (For all editions of Azure SQL Edge) 11 = Azure Synapse serverless SQL pool, or Microsoft Fabric 12 = Microsoft Fabric SQL database in Microsoft Fabric.”[1]

SQL Server 2025 procedure definitions use value 12 in several branches that also test value 5. Both boxed SQL Server test instances returned value 3:

Where the branches appear

I searched every extracted definition in the 2019, 2022 and 2025 folders for EngineEdition. The number of modules increased from 37 in 2019 to 61 in 2022 and 69 in 2025. The value 12 is tested in 26 of the 2025 modules. None of the 2019 or 2022 definitions tested value 12.

The definitions also test additional engine edition values. SQL Server 2019 mostly tested 5 for SQL Database, 8 for Managed Instance, and the boxed-engine values 2, 3 and 4. SQL Server 2022 added checks for 9 in sp_addlinkedserver and sp_estimate_data_compression_savings, plus 10 in sp_upgrade_log_shipping. SQL Server 2025 kept those and added 12 across catalog views, change data capture procedures, sp_help, sp_helpindex, sp_tableoption, sp_updatestats, and sp_estimate_data_compression_savings.

I am not treating a branch as proof that the feature works on every listed engine. The definition only shows what the procedure does when SERVERPROPERTY('EngineEdition') returns that value.

sp_help skips SQL Server-style object work on 12

In SQL Server 2022, sp_help runs two branches when the engine is not SQL Database. SQL Server 2025 changes both branches to exclude value 12 too.

The Learn page for sp_help now lists SQL database in Microsoft Fabric in its Applies to list, but the page documents result sets rather than this branch.[2] On a boxed SQL Server instance that returns value 3, the SQL Server branch runs. On an engine that returns 5 or 12, that branch does not run, so object metadata can come from the shorter path that the procedure already used for SQL Database.

sp_helpindex stops looking up a data space on 12

sp_helpindex has a small branch with a caller-visible result. The procedure builds index_description, and part of that description can include the data-space name.

The sp_helpindex Learn page documents the three returned columns: index_name, index_description and index_keys.[3] The definition change means that value 12 follows the SQL Database path and does not look up sys.data_spaces for @groupname. A boxed SQL Server instance that returns value 3 still enters the branch that looks up sys.data_spaces, as it did in 2022.

sp_updatestats changes the db_owner permission exception

sp_updatestats has a permission check near the top. SQL Server 2022 let db_owner pass only when EngineEdition was 5. SQL Server 2025 adds 12.

The Learn page says that SQL Server requires the caller to be the database owner or a member of the sysadmin fixed server role. It says Azure SQL Database requires membership in the db_owner fixed database role.[4] The procedure body gives value 12 the same db_owner exception as value 5. This can affect scripts that run under database-level permissions on a Fabric SQL database. It does not widen permissions on a boxed instance that returns value 3.

sp_estimate_data_compression_savings adds 12 to three checks

sp_estimate_data_compression_savings already had a broad edition gate in 2022. SQL Server 2025 adds 12 to it, and also adds two later checks that skip some work on values 5 and 12.

The Learn page documents that sp_estimate_data_compression_savings applies to SQL Server, Azure SQL Database, Azure SQL Managed Instance and SQL database in Microsoft Fabric.[5] The comment text inside the definition uses an internal name for value 12. I am not expanding that name because I did not find a public source that explains it in SQL Server documentation.

sp_spaceused has a separate FIDO branch

The sp_spaceused branch predates these EngineEdition 12 checks. It appeared in the SQL Server 2022 definition and remains in the SQL Server 2025 definition. It does not test EngineEdition. Instead, it tests a dynamic management view (DMV), which is a system view that exposes engine state.

The sp_spaceused Learn page documents the procedure syntax and result sets. It does not mention sys.dm_dw_databases or sys.sp_fido_spaceused in the page text I fetched.[6] I also searched the SQL Server, Azure and Fabric documentation source repositories for those two names, first whole-word and then case-insensitive. I did not find a match.[7]

On the local SQL Server 2025 boxed instance, the DMV exists but has no rows in master:

In this test, the sp_spaceused branch is not taken in master on the boxed instance. It does not prove what happens on every database or every engine surface.

Why I care about the old procedures

The changed definitions do not mean that sp_help, sp_helpindex, sp_updatestats or sp_spaceused changed behaviour on my local boxed SQL Server instances. They both return EngineEdition 3, so the value 12 branches do not run there.

Microsoft ships one procedure body with branches for SQL Server, Azure SQL Database, Managed Instance, Fabric SQL database, and other engine surfaces. DBA scripts still call some of these procedures. When a script uses one of them to return metadata, the engine edition can select the procedure path.

If you have seen a system procedure return different metadata across engine surfaces, tell me on Bluesky or LinkedIn, and I’ll update the notes.

References

  1. SERVERPROPERTY (Transact-SQL) - Microsoft Learn. Documents the EngineEdition value list, including value 12 as Microsoft Fabric SQL database in Microsoft Fabric. ↩
  2. sys.sp_help (Transact-SQL) - Microsoft Learn. Documents the procedure result sets and Applies to list checked against the EngineEdition 12 branch. ↩
  3. sys.sp_helpindex (Transact-SQL) - Microsoft Learn. Documents the sp_helpindex result set checked against the EngineEdition 12 data-space branch. ↩
  4. sys.sp_updatestats (Transact-SQL) - Microsoft Learn. Documents the permission section checked against the EngineEdition 12 branch. ↩
  5. sys.sp_estimate_data_compression_savings (Transact-SQL) - Microsoft Learn. Documents the Applies to list checked against the 2025 edition gate. ↩
  6. sys.sp_spaceused (Transact-SQL) - Microsoft Learn. Documents the syntax and result sets checked against the sys.dm_dw_databases branch. ↩
  7. MicrosoftDocs/sql-docs, MicrosoftDocs/azure-docs and MicrosoftDocs/fabric-docs - GitHub. Markdown source repositories searched on 2026-09-26 with whole-word fixed-string grep and case-insensitive follow-up for sys.dm_dw_databases and sys.sp_fido_spaceused. ↩