mirror of
https://dev.azure.com/effectory/Survey%20Software/_git/Cloud%20Engineering
synced 2026-02-27 18:52:18 +01:00
Added more storage scripts #115638
This commit is contained in:
32
SQL/ListDatabaseObjects.sql
Normal file
32
SQL/ListDatabaseObjects.sql
Normal 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;
|
||||
Reference in New Issue
Block a user