Select all UDFs from database?

169 views Asked by At

Something like:

SELECT * FROM sys.functions
3

There are 3 answers

0
JBrooks On BEST ANSWER

for SQLServer2005 it is:

SELECT * 
    FROM sys.objects 
    WHERE type in ('TF','FN','IF') 
1
Mongus Pong On

This will give you the names and the definitions :

SELECT SPECIFIC_NAME, ROUTINE_DEFINITION
    FROM INFORMATION_SCHEMA.ROUTINES 
WHERE ROUTINE_TYPE = 'FUNCTION'
0
jammus On

Something like this will give you all the details of the udfs you've created.

SELECT *
    FROM
        sysobjects
    WHERE
        (type = 'TF' OR type = 'FN' OR type = 'IF')
        AND
        objectproperty(id, 'IsMSShipped') = 0

Get rid of the second condition if you want everything.