views:

70

answers:

5

How can i view all the functions (build in) in sql database using sql management studio?

+1  A: 

do you mean the functions under ...Programmability...Functions for 2005 and 2008?

Mike
+3  A: 

This will return all user-defined functions. I'm not sure what you mean by "build-in" functions.

SELECT * 
FROM sys.objects 
WHERE RIGHT(type_desc, 8) = 'FUNCTION'

OR

SELECT * FROM sys.all_objects where type in ('FN','AF','FS','FT','IF','TF')

Here are the types:

--AF = Aggregate function (CLR)
--C = CHECK constraint
--D = DEFAULT (constraint or stand-alone)
--F = FOREIGN KEY constraint
--PK = PRIMARY KEY constraint
--P = SQL stored procedure
--PC = Assembly (CLR) stored procedure
--FN = SQL scalar-function
--FS = Assembly (CLR) scalar function
--FT = Assembly (CLR) table-valued function
--R = Rule (old-style, stand-alone)
--RF = Replication filter procedure
--SN = Synonym
--SQ = Service queue
--TA = Assembly (CLR) trigger
--TR = SQL trigger 
--IF = SQL inlined table-valued function
--TF = SQL table-valued function
--U = Table (user-defined)
--UQ = UNIQUE constraint
--V = View
--X = Extended stored procedure
--IT = Internal table

Here is a list of all system stored procs:

http://msdn.microsoft.com/en-us/library/ms187961.aspx

camainc
i see all table valued and scalar valued functions but not the system functions. Anyclue?
sanjeev40084
When we use 'sys.all_objects' is it returning all the objects from all the database or the database against which you are running the query?
sanjeev40084
all the objects in the database you're running the query on. System functions are all in the 'sys' schema.
thecoop
but didn't you say you wanted to see them through the management studio?
Mike
+1  A: 

Not on the SSMS, but in TSQL

select * from master..sysobjects where type = 'fn'

But do you mean also DMV's, sprocs etc?

nonnb
A: 

To get all User Defined function of a particular database use the below code

USE AdventureWorks;
GO
SELECT name AS function_name
,SCHEMA_NAME(schema_id) AS schema_name
,type_desc
FROM sys.objects
WHERE type_desc LIKE '%FUNCTION%';
GO
anishmarokey
A: 

Any reason why i can't grant privs on some of the functions?

sanjeev40084