So you're wanting to know some basic dates around a schema in SQL Server. Unfortunately the "sys.schemas" view doesn't have anything to indicate create or modify dates. Furthermore if the schema creation isn't logged, then the only way to review this is to relate the schema to the "sys.objects" view.
Here is the query to looks at this:
select
ss.name,
count(so.object_id) as ObjectCount,
min(so.create_date) as EarliestCreateDate,
max(so.create_date) as LatestCreateDate,
min(so.modify_date) as EarliestModifyDate,
max(so.modify_date) as LatestModifyDate
from
sys.schemas ss
inner join
sys.objects so on so.schema_id = ss.schema_id
group by
ss.name
order by
LatestModifyDate desc
No comments:
Post a Comment
Please only include comments that add to the substance of the Blog Post:
- Question or request for clarification
- Idea for improvement
- Identifying an issue
Please refrain from promotion.