How to find function definition How can I find the definitions of below system functions in SQL Server:


has_access  
permission_name


I tried with DAC connection but getting below error:

Msg 15009, Level 16, State 1, Procedure sp_helptext, Line 54 [Batch Start Line 118]
The object 'has_access' does not exist in database 'master' or is invalid for this operation.


Please let me know if any further details are required. Thanks!
These two functions appear to be internal / built-in functions given that:


they are referenced without a schema-name
SSMS color-codes them the same as all other built-in functions


sys.server_permissions, on Line #7, has:

        p.type, permission_name(p.class, p.type) AS permission_name,


sys.server_principals, on Line # 18, has:

    WHERE has_access('LG', p.id) = 1


When the instance is in single-user mode, I can execute the following:

USE [mssqlsystemresource];
SELECT PERMISSION_NAME(100, 'COSQ');
-- CONNECT SQL


The same statement does not work outside of mssqlsystemresource, nor does it work in that DB when prefixed with sys. or dbo..

Ergo, no, there is no definition that you will be able to get.