How to add definition column to this query?

Viewed 32

I have such sql-query and want to show definition (that is code of function) but there is no such column in the table sys.objects. Can someone help with it?

 SELECT name, create_date, modify_date
  FROM sys.objects o 
WHERE type_desc like '%function%'
1 Answers

You can take this data from the table sys.sql_modules. Try this code:

SELECT o.name, m.definition, o.create_date, o.modify_date
FROM sys.sql_modules m 
INNER JOIN sys.objects o 
ON m.object_id=o.object_id
WHERE type_desc like '%function%'
Related