Here is my query:
SELECT
sys.objects.object_id, sys.objects.name, sys.objects.type_desc,
sys.syscomments.text
FROM
sys.objects
LEFT JOIN
sys.syscomments ON sys.syscomments.id = sys.objects.object_id
WHERE
(type_desc LIKE 'SQL_STORED_PROCEDURE' OR type_desc LIKE 'SQL_SCALAR_FUNCTION')
ORDER BY
sys.objects.object_id;
Here is part of the output:
So how would I concatenate the 'text' columns for rows with the same 'object_id' so that I don't have duplicates ID? Not so simple in T-SQL without an aggregate function for strings...
I've seen other examples but I can't seem to get it working for my scenario.