Skip to main content
added 142 characters in body; edited tags; edited title
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

How to find Finding the names of all objects in the Resource database?

I'm looking at the sys.dm_exec_function_statssys.dm_exec_function_stats view to find Scalar Functionscalar function stats. That view also includes rows from a database with an id 32767, which I've found is the Resource Databasedatabase.

Some of these IDs can be passed to OBJECT_NAME() or OBJECT_DEFINITION() Metadata functions but some IDs return NULL

SELECT SERVERPROPERTY('ResourceVersion')  AS 'ResourceVersion'
SELECT SERVERPROPERTY('ResourceLastUpdateDateTime') AS 'ResourceLastUpdateDateTime' 

SELECT 
    defs.database_id
    , defs.object_id
    , OBJECT_NAME(defs.object_id) AS objName
    , OBJECT_DEFINITION(defs.object_id) AS objDef
    , OBJECT_NAME(defs.object_id, defs.database_id) AS objNameDB
    , OBJECT_DEFINITION(defs.object_id, defs.database_id) AS objDefDB
FROM sys.dm_exec_function_stats AS defs
WHERE defs.database_id = 32767
SELECT SERVERPROPERTY('ResourceVersion')  AS 'ResourceVersion'
SELECT SERVERPROPERTY('ResourceLastUpdateDateTime') AS 'ResourceLastUpdateDateTime' 

SELECT 
    defs.database_id
    , defs.object_id
    , OBJECT_NAME(defs.object_id) AS objName
    , OBJECT_DEFINITION(defs.object_id) AS objDef
    , OBJECT_NAME(defs.object_id, defs.database_id) AS objNameDB
    , OBJECT_DEFINITION(defs.object_id, defs.database_id) AS objDefDB
FROM sys.dm_exec_function_stats AS defs
WHERE defs.database_id = 32767

enter image description here

I can find the fn_hadr_is_primary_replica function (object_id = -665919249) in the sys.all_objects or in sys.all_sql_modules, but not the object_id = -706609674.

Is there any way how to find the object name or definition of the -706609674?

How to find names of all objects in Resource database?

I'm looking at the sys.dm_exec_function_stats view to find Scalar Function stats. That view also includes rows from a database with an id 32767, which I've found is the Resource Database.

Some of these IDs can be passed to OBJECT_NAME() or OBJECT_DEFINITION() Metadata functions but some IDs return NULL

SELECT SERVERPROPERTY('ResourceVersion')  AS 'ResourceVersion'
SELECT SERVERPROPERTY('ResourceLastUpdateDateTime') AS 'ResourceLastUpdateDateTime' 

SELECT 
    defs.database_id
    , defs.object_id
    , OBJECT_NAME(defs.object_id) AS objName
    , OBJECT_DEFINITION(defs.object_id) AS objDef
    , OBJECT_NAME(defs.object_id, defs.database_id) AS objNameDB
    , OBJECT_DEFINITION(defs.object_id, defs.database_id) AS objDefDB
FROM sys.dm_exec_function_stats AS defs
WHERE defs.database_id = 32767

enter image description here

I can find the fn_hadr_is_primary_replica function (object_id = -665919249) in the sys.all_objects or in sys.all_sql_modules, but not the object_id = -706609674

Is there any way how to find the object name or definition of the -706609674?

Finding the names of objects in the Resource database

I'm looking at the sys.dm_exec_function_stats view to find scalar function stats. That view also includes rows from a database with an id 32767, which I've found is the Resource database.

Some of these IDs can be passed to OBJECT_NAME() or OBJECT_DEFINITION() Metadata functions but some IDs return NULL

SELECT SERVERPROPERTY('ResourceVersion')  AS 'ResourceVersion'
SELECT SERVERPROPERTY('ResourceLastUpdateDateTime') AS 'ResourceLastUpdateDateTime' 

SELECT 
    defs.database_id
    , defs.object_id
    , OBJECT_NAME(defs.object_id) AS objName
    , OBJECT_DEFINITION(defs.object_id) AS objDef
    , OBJECT_NAME(defs.object_id, defs.database_id) AS objNameDB
    , OBJECT_DEFINITION(defs.object_id, defs.database_id) AS objDefDB
FROM sys.dm_exec_function_stats AS defs
WHERE defs.database_id = 32767

enter image description here

I can find the fn_hadr_is_primary_replica function (object_id = -665919249) in the sys.all_objects or in sys.all_sql_modules, but not the object_id = -706609674.

Is there any way how to find the object name or definition of the -706609674?

2
Paul White
  • 90.3k
  • 30
  • 424
  • 663
Post Closed as "Duplicate" by Charlieface, Paul White sql-server
Source Link
Zikato
  • 5.5k
  • 1
  • 16
  • 34

How to find names of all objects in Resource database?

I'm looking at the sys.dm_exec_function_stats view to find Scalar Function stats. That view also includes rows from a database with an id 32767, which I've found is the Resource Database.

Some of these IDs can be passed to OBJECT_NAME() or OBJECT_DEFINITION() Metadata functions but some IDs return NULL

SELECT SERVERPROPERTY('ResourceVersion')  AS 'ResourceVersion'
SELECT SERVERPROPERTY('ResourceLastUpdateDateTime') AS 'ResourceLastUpdateDateTime' 

SELECT 
    defs.database_id
    , defs.object_id
    , OBJECT_NAME(defs.object_id) AS objName
    , OBJECT_DEFINITION(defs.object_id) AS objDef
    , OBJECT_NAME(defs.object_id, defs.database_id) AS objNameDB
    , OBJECT_DEFINITION(defs.object_id, defs.database_id) AS objDefDB
FROM sys.dm_exec_function_stats AS defs
WHERE defs.database_id = 32767

enter image description here

I can find the fn_hadr_is_primary_replica function (object_id = -665919249) in the sys.all_objects or in sys.all_sql_modules, but not the object_id = -706609674

Is there any way how to find the object name or definition of the -706609674?