[sql]代码库
SELECT sp.NAME,
SCHEMA_NAME(sp.schema_id),
c.TEXT
FROM sys.all_objects AS sp
INNER JOIN dbo.syscomments c ON c.id = sp.object_id
AND CASE
WHEN c.number > 1
THEN c.number
ELSE 0
END = 0
WHERE (
sp.type = N'P'
OR sp.type = N'RF'
OR sp.type = N'PC'
)
AND (
CAST(CASE
WHEN sp.is_ms_shipped = 1
THEN 1
WHEN (
SELECT major_id
FROM sys.extended_properties
WHERE major_id = sp.object_id
AND minor_id = 0
AND class = 1
AND NAME = N'microsoft_database_tools_support'
) IS NOT NULL
THEN 1
ELSE 0
END AS BIT) = 0
)