HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Is there a way to view the body / contents of a system function in sql server 2008

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
the2008sqlsystemwayviewcontentsfunctionserverbody

Problem

For the sake of leaning and exploring, I'd like to look at how some of the system functions are built. Is there a way to do this in sql server 2008 or R2?

I've tried sp_helptext 'Sum' but I get an error saying that the resource cannot be found.

Solution

I don't think Sum is stored as a T-SQL function in your system that you could "peek" into. That's most likely code deep inside the SQL Server core.

As a proof - you can e.g. get the body of other system stored functions using sp_helptext:

sp_helptext 'sys.fn_isrolemember'


That works just fine - so that leads me to believe that Sum isn't a stored function as such.

Code Snippets

sp_helptext 'sys.fn_isrolemember'

Context

StackExchange Database Administrators Q#12592, answer score: 2

Revisions (0)

No revisions yet.