Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

SQL Server 2005 has great sys.XXX views on the system catalog which I use frequently.

What stumbles me is this: why is there a "sys.procedures" view to see info about your stored procedures, but there are no "sys. functions" view to see the same for your stored functions?

Doesn't anybody use stored functions? I find them very handy for e.g. computed columns and such!

Is there a specific reason sys.functions is missing or is it just something that wasn't considered important enough to put into the sys catalog views?? Is it available in SQL Server 2008??

Cheers, Marc

1 Answer

0 votes
by (40.7k points)

In SQL Server 2005, any of Microsoft's rationale is used for not including a sys.functions equivalent. But you can it to roll your own: 

CREATE VIEW my_sys_functions_equivalent

AS

SELECT *

FROM sys.objects

WHERE type IN ('FN', 'IF', 'TF')  -- scalar, inline table-valued, table-valued

You can use UDFs all the time.

...