Added more storage scripts #115638

This commit is contained in:
Jurjen Ladenius
2025-10-08 08:31:36 +02:00
parent f96deb9bf7
commit 8a57c600a0
11 changed files with 85982 additions and 59 deletions

View File

@@ -0,0 +1,32 @@
-- Query to list all objects in a database with their types
SELECT
s.name + '.' + o.name AS ObjectName,
CASE o.type
WHEN 'U' THEN 'User Table'
WHEN 'V' THEN 'View'
WHEN 'P' THEN 'Stored Procedure'
WHEN 'FN' THEN 'Scalar Function'
WHEN 'IF' THEN 'Inline Table Function'
WHEN 'TF' THEN 'Table Function'
WHEN 'TR' THEN 'Trigger'
WHEN 'PK' THEN 'Primary Key'
WHEN 'F' THEN 'Foreign Key'
WHEN 'C' THEN 'Check Constraint'
WHEN 'D' THEN 'Default Constraint'
WHEN 'UQ' THEN 'Unique Constraint'
WHEN 'S' THEN 'System Table'
WHEN 'SQ' THEN 'Service Queue'
WHEN 'IT' THEN 'Internal Table'
WHEN 'X' THEN 'Extended Stored Procedure'
WHEN 'PC' THEN 'CLR Stored Procedure'
WHEN 'FS' THEN 'CLR Scalar Function'
WHEN 'FT' THEN 'CLR Table Function'
WHEN 'AF' THEN 'CLR Aggregate Function'
ELSE 'Other'
END AS ObjectType,
o.modify_date AS ModifiedDate
FROM sys.objects o
INNER JOIN sys.schemas s ON o.schema_id = s.schema_id
WHERE o.is_ms_shipped = 0 -- Exclude system objects
and not (o.type in ('TR','PK','F','C','D','UQ','S','SQ','IT','',''))
ORDER BY s.name, ObjectType, o.name;